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

Configure Feed

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

commit before ai fucks shit up

Florian 8d98f19c 5c1a5855

+95 -27
+38 -2
src/lib/EditableWebsite.svelte
··· 25 25 import { dev } from '$app/environment'; 26 26 import { setDidContext, setHandleContext } from './website/context'; 27 27 import BaseEditingCard from './cards/BaseCard/BaseEditingCard.svelte'; 28 + import Settings from './Settings.svelte'; 28 29 29 30 let { 30 31 handle, 31 32 did, 32 33 data, 33 - items: originalItems 34 - }: { handle: string; did: string; data: any; items: Item[] } = $props(); 34 + items: originalItems, 35 + settings 36 + }: { handle: string; did: string; data: any; items: Item[]; settings: any } = $props(); 35 37 36 38 // svelte-ignore state_referenced_locally 37 39 let items: Item[] = $state(originalItems); ··· 183 185 const sidebarItems = AllCardDefinitions.filter( 184 186 (cardDef) => cardDef.sidebarComponent || cardDef.sidebarButtonText 185 187 ); 188 + 189 + let showSettings = $state(false); 186 190 </script> 187 191 188 192 {#if !dev} ··· 334 338 </div> 335 339 </div> 336 340 </div> 341 + 342 + <Settings bind:open={showSettings} /> 337 343 338 344 <Sidebar mobileOnly mobileClasses="lg:block p-4 gap-4"> 339 345 <div class="flex flex-col gap-2"> ··· 357 363 ]} 358 364 > 359 365 <div class="flex items-center gap-2"> 366 + {#if dev} 367 + <Button 368 + size="iconLg" 369 + variant="ghost" 370 + class="mr-4 backdrop-blur-none" 371 + onclick={() => { 372 + showSettings = true; 373 + }} 374 + > 375 + <svg 376 + xmlns="http://www.w3.org/2000/svg" 377 + fill="none" 378 + viewBox="0 0 24 24" 379 + stroke-width="1.5" 380 + stroke="currentColor" 381 + > 382 + <path 383 + stroke-linecap="round" 384 + stroke-linejoin="round" 385 + d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z" 386 + /> 387 + <path 388 + stroke-linecap="round" 389 + stroke-linejoin="round" 390 + d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" 391 + /> 392 + </svg> 393 + </Button> 394 + {/if} 395 + 360 396 <Button 361 397 size="iconLg" 362 398 variant="ghost"
+11
src/lib/Settings.svelte
··· 1 + <script lang="ts"> 2 + import { Modal } from '@foxui/core'; 3 + 4 + export type Settings = { 5 + title: string; 6 + }; 7 + 8 + let { open = $bindable(), settings }: { open: boolean; settings: Settings } = $props(); 9 + </script> 10 + 11 + <Modal bind:open>Settings</Modal>
+1 -1
src/lib/index.ts
··· 1 1 // place files you want to import through the `$lib` alias in this folder. 2 - export const margin = 16; 2 + export const margin = 20; 3 3 export const mobileMargin = 12;
+2 -1
src/lib/website/data.ts
··· 4 4 export const data = { 5 5 'app.bsky.actor.profile': ['self'], 6 6 7 - 'app.blento.card': 'all' 7 + 'app.blento.card': 'all', 8 + 'app.blento.settings': ['self'] 8 9 } as const;
+34 -21
src/lib/website/load.ts
··· 20 20 additionalData: Record<string, unknown>; 21 21 updatedAt: number; 22 22 }> { 23 + console.log(handle); 23 24 if (!forceUpdate) { 24 - const cachedResult = await platform?.env?.USER_DATA_CACHE?.get(handle); 25 + try { 26 + const cachedResult = await platform?.env?.USER_DATA_CACHE?.get(handle); 25 27 26 - if (cachedResult) { 27 - const result = JSON.parse(cachedResult); 28 - const update = result.updatedAt; 29 - const timePassed = (Date.now() - update) / 1000; 30 - console.log( 31 - 'using cached result for handle', 32 - handle, 33 - 'last update', 34 - timePassed, 35 - 'seconds ago' 36 - ); 37 - return JSON.parse(cachedResult); 28 + if (cachedResult) { 29 + const result = JSON.parse(cachedResult); 30 + const update = result.updatedAt; 31 + const timePassed = (Date.now() - update) / 1000; 32 + console.log( 33 + 'using cached result for handle', 34 + handle, 35 + 'last update', 36 + timePassed, 37 + 'seconds ago' 38 + ); 39 + return JSON.parse(cachedResult); 40 + } 41 + } catch (error) { 42 + console.log('getting cached result failed', error); 38 43 } 39 44 } 40 45 ··· 54 59 try { 55 60 if (Array.isArray(cfg)) { 56 61 for (const rkey of cfg) { 57 - const record = getRecord({ did, collection, rkey }); 62 + const record = getRecord({ did, collection, rkey }).catch((error) => { 63 + console.error('error getting record', rkey, 'for collection', collection); 64 + }); 58 65 promises.push({ 59 66 collection, 60 67 rkey, ··· 62 69 }); 63 70 } 64 71 } else if (cfg === 'all') { 65 - const records = listRecords({ did, collection }); 72 + const records = listRecords({ did, collection }).catch((error) => { 73 + console.error('error getting records for collection', collection); 74 + }); 66 75 promises.push({ collection, record: records }); 67 76 } 68 77 } catch (error) { ··· 102 111 const cardDef = CardDefinitionsByType[cardType]; 103 112 104 113 if (cardDef.loadData) { 105 - additionDataPromises[cardType] = cardDef.loadData( 106 - Object.values(downloadedData['app.blento.card']) 107 - .filter((v) => cardType == v.value.cardType) 108 - .map((v) => v.value) as Item[], 109 - loadOptions 110 - ); 114 + additionDataPromises[cardType] = cardDef 115 + .loadData( 116 + Object.values(downloadedData['app.blento.card']) 117 + .filter((v) => cardType == v.value.cardType) 118 + .map((v) => v.value) as Item[], 119 + loadOptions 120 + ) 121 + .catch((error) => { 122 + console.error('error getting additional data for', cardType, error); 123 + }); 111 124 } 112 125 } 113 126
+1
src/routes/[handle]/+page.svelte
··· 20 20 handle={page.params.handle} 21 21 did={data.did} 22 22 items={Object.values(data.data['app.blento.card']).map((i) => i.value) as Item[]} 23 + settings={data.data['app.blento.settings']?.['self']?.value} 23 24 />
+2
src/routes/[handle]/edit/+page.svelte
··· 15 15 did={data.did} 16 16 {data} 17 17 items={Object.values(data.data['app.blento.card']).map((i) => i.value) as Item[]} 18 + 19 + settings={data.data['app.blento.settings']?.['self']?.value} 18 20 />
+6 -2
todo.md
··· 3 3 - video card 4 4 - edit already created cards (e.g. change link) 5 5 - link card: save favicon and og image to pds 6 - - more cards list 6 + - [x] more cards list 7 7 - paste handler for card creation 8 8 - text cards: align text top middle bottom and left center right 9 + - change general settings: 10 + - show profile 11 + - base, accent color 9 12 - more cards: 10 13 - instagram 11 14 - github ··· 27 30 - popfeed.social 28 31 - smoke signal 29 32 - statusphere.xyz 30 - - add some caching to user data 33 + 34 + - [x] add some caching to user data 31 35 32 36 - other fun card ideas: 33 37 - svader