your personal website on atproto - mirror blento.app
26
fork

Configure Feed

Select the types of activity you want to include in your feed.

only show germ if collection present

Florian d1a65400 34efea62

+55 -22
+1
src/lib/cards/media/TealFMPlaysCard/index.ts
··· 22 22 }, 23 23 minW: 4, 24 24 canHaveLabel: true, 25 + canAdd: ({ collections }) => collections.includes('fm.teal.alpha.feed.play'), 25 26 26 27 keywords: ['music', 'scrobble', 'listening', 'songs'], 27 28 name: 'Teal.fm Plays',
+4 -1
src/lib/cards/social/GermDMCard/index.ts
··· 32 32 return null; 33 33 } 34 34 }, 35 + canAdd: ({ collections }) => collections.includes('com.germnetwork.declaration'), 35 36 defaultColor: 'transparent', 36 37 allowSetColor: false, 37 38 canHaveLabel: true, 38 39 name: 'DM on Germ', 39 40 keywords: ['germ', 'dm', 'message', 'chat', 'encrypted'], 40 41 groups: ['Social'], 41 - icon: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="size-4">${germ.svg.replace(/<svg[^>]*>/, '').replace(/<\/svg>/, '')}</svg>` 42 + icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4"> 43 + <path stroke-linecap="round" stroke-linejoin="round" d="M12.75 3.03v.568c0 .334.148.65.405.864l1.068.89c.442.369.535 1.01.216 1.49l-.51.766a2.25 2.25 0 0 1-1.161.886l-.143.048a1.107 1.107 0 0 0-.57 1.664c.369.555.169 1.307-.427 1.605L9 13.125l.423 1.059a.956.956 0 0 1-1.652.928l-.679-.906a1.125 1.125 0 0 0-1.906.172L4.5 15.75l-.612.153M12.75 3.031a9 9 0 0 0-8.862 12.872M12.75 3.031a9 9 0 0 1 6.69 14.036m0 0-.177-.529A2.25 2.25 0 0 0 17.128 15H16.5l-.324-.324a1.453 1.453 0 0 0-2.328.377l-.036.073a1.586 1.586 0 0 1-.982.816l-.99.282c-.55.157-.894.702-.8 1.267l.073.438c.08.474.49.821.97.821.846 0 1.598.542 1.865 1.345l.215.643m5.276-3.67a9.012 9.012 0 0 1-5.276 3.67m0 0a9 9 0 0 1-10.275-4.835M15.75 9c0 .896-.393 1.7-1.016 2.25" /> 44 + </svg>` 42 45 } as CardDefinition & { type: 'germDM' };
+2
src/lib/cards/types.ts
··· 73 73 74 74 canResize?: boolean; 75 75 76 + canAdd?: (context: { collections: string[] }) => boolean; 77 + 76 78 onUrlHandler?: (url: string, item: Item) => Item | null; 77 79 urlHandlerPriority?: number; 78 80
+40 -18
src/lib/components/card-command/CardCommand.svelte
··· 3 3 import type { CardDefinition } from '$lib/cards/types'; 4 4 import { Command, Dialog } from 'bits-ui'; 5 5 import { isTyping } from '$lib/helper'; 6 - 7 - const CardDefGroups = [ 8 - 'Core', 9 - ...Array.from( 10 - new Set( 11 - AllCardDefinitions.map((cardDef) => cardDef.groups) 12 - .flat() 13 - .filter((g) => g) 14 - ) 15 - ) 16 - .sort() 17 - .filter((g) => g !== 'Core') 18 - ]; 6 + import { describeRepo, user } from '$lib/atproto'; 19 7 20 8 let { 21 9 open = $bindable(false), ··· 27 15 onlink?: (url: string, cardDef: CardDefinition) => void; 28 16 } = $props(); 29 17 18 + let collections = $state<string[]>([]); 19 + let fetchedForDid = $state<string | undefined>(undefined); 20 + 21 + $effect(() => { 22 + if (open && user.did && fetchedForDid !== user.did) { 23 + const did = user.did; 24 + describeRepo({ did }).then((result) => { 25 + if (result?.collections) { 26 + collections = result.collections; 27 + } 28 + fetchedForDid = did; 29 + }); 30 + } 31 + }); 32 + 33 + let filteredCardDefs = $derived( 34 + AllCardDefinitions.filter((d) => !d.canAdd || d.canAdd({ collections })) 35 + ); 36 + 37 + let cardDefGroups = $derived([ 38 + 'Core', 39 + ...Array.from( 40 + new Set( 41 + filteredCardDefs 42 + .map((cardDef) => cardDef.groups) 43 + .flat() 44 + .filter((g) => g) 45 + ) 46 + ) 47 + .sort() 48 + .filter((g) => g !== 'Core') 49 + ]); 50 + 30 51 let searchValue = $state(''); 31 52 32 53 let normalizedUrl = $derived.by(() => { ··· 44 65 45 66 let urlMatchingCards = $derived.by(() => { 46 67 if (!normalizedUrl) return []; 47 - return AllCardDefinitions.filter((d) => d.onUrlHandler) 68 + return filteredCardDefs 69 + .filter((d) => d.onUrlHandler) 48 70 .filter((d) => { 49 71 try { 50 72 const testItem = { cardData: {} }; ··· 150 172 <Command.Separator class="bg-base-900/5 dark:bg-base-50/5 my-1 h-px w-full" /> 151 173 {/if} 152 174 153 - {#each CardDefGroups as group, index (group)} 154 - {#if group && AllCardDefinitions.some((cardDef) => cardDef.groups?.includes(group))} 175 + {#each cardDefGroups as group, index (group)} 176 + {#if group && filteredCardDefs.some((cardDef) => cardDef.groups?.includes(group))} 155 177 <Command.Group> 156 178 <Command.GroupHeading 157 179 class="text-base-600 dark:text-base-400 px-3 pt-4 pb-2 text-xs" ··· 159 181 {group} 160 182 </Command.GroupHeading> 161 183 <Command.GroupItems> 162 - {#each AllCardDefinitions.filter( (cardDef) => cardDef.groups?.includes(group) ) as cardDef (cardDef.type)} 184 + {#each filteredCardDefs.filter( (cardDef) => cardDef.groups?.includes(group) ) as cardDef (cardDef.type)} 163 185 <Command.Item 164 186 onSelect={() => { 165 187 open = false; ··· 179 201 {/each} 180 202 </Command.GroupItems> 181 203 </Command.Group> 182 - {#if index < CardDefGroups.length - 1} 204 + {#if index < cardDefGroups.length - 1} 183 205 <Command.Separator class="bg-base-900/5 dark:bg-base-50/5 my-1 h-px w-full" /> 184 206 {/if} 185 207 {/if}
+8 -3
src/routes/(auth)/oauth/callback/+page.svelte
··· 13 13 if (user.profile) { 14 14 if (hasRedirected) return; 15 15 16 - const redirect = localStorage.getItem('login-redirect'); 16 + let redirect = localStorage.getItem('login-redirect'); 17 17 localStorage.removeItem('login-redirect'); 18 - console.log('redirect', redirect); 19 - goto(redirect || '/' + getHandleOrDid(user.profile) + '/edit', {}); 18 + 19 + const editPath = '/' + getHandleOrDid(user.profile) + '/edit'; 20 + if (!redirect || redirect === '/' || redirect === 'https://blento.app' || redirect === 'https://blento.app/') { 21 + redirect = editPath; 22 + } 23 + 24 + goto(redirect, {}); 20 25 21 26 hasRedirected = true; 22 27 }