my website at ewancroft.uk
6
fork

Configure Feed

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

refactor: remove tangled repository cards and service layer

Remove TangledRepoCard component, fetchTangledRepos wrapper,
type exports, and cache configuration. No longer used on the
homepage.

+10 -138
-114
src/lib/components/layout/main/card/TangledRepoCard.svelte
··· 1 - <script lang="ts"> 2 - import { ExternalLink, GitBranch, Server, User } from '@lucide/svelte'; 3 - import { Card, InternalCard } from '$lib/components/ui'; 4 - import type { TangledReposData, ProfileData } from '$lib/services/atproto'; 5 - import { PUBLIC_ATPROTO_DID } from '$env/static/public'; 6 - 7 - interface Props { 8 - repos?: TangledReposData | null; 9 - profile?: ProfileData | null; 10 - } 11 - 12 - let { repos = null, profile = null }: Props = $props(); 13 - 14 - // Derive handle from profile 15 - let handle = $derived(profile?.handle || null); 16 - 17 - // Build the tangled.org URL: tangled.org/[handle or did]/[repo] 18 - // Prefer handle if available, otherwise use DID 19 - function buildRepoUrl(repoName: string): string { 20 - const identifier = handle || PUBLIC_ATPROTO_DID; 21 - return `https://tangled.org/${identifier}/${repoName}`; 22 - } 23 - 24 - // Extract knot server name from DID or URL 25 - function getKnotServerName(knot: string): string { 26 - if (knot.startsWith('http')) { 27 - try { 28 - return new URL(knot).hostname; 29 - } catch { 30 - return knot; 31 - } 32 - } 33 - // If it's a DID, just return it as-is 34 - return knot; 35 - } 36 - </script> 37 - 38 - <div class="mx-auto w-full max-w-2xl"> 39 - {#if !repos} 40 - <Card loading={true} variant="elevated" padding="md"> 41 - {#snippet skeleton()} 42 - <div class="mb-4 h-6 w-32 rounded bg-canvas-300 dark:bg-canvas-700"></div> 43 - <div class="space-y-3"> 44 - {#each Array(3) as _} 45 - <div class="h-24 rounded-lg bg-canvas-300 dark:bg-canvas-700"></div> 46 - {/each} 47 - </div> 48 - {/snippet} 49 - </Card> 50 - {:else if repos.repos.length > 0} 51 - {@const safeRepos = repos} 52 - <Card variant="elevated" padding="md"> 53 - {#snippet children()} 54 - <h2 class="mb-4 text-2xl font-bold text-ink-900 dark:text-ink-50">Tangled Repositories</h2> 55 - <div class="space-y-3"> 56 - {#each safeRepos.repos as repo} 57 - <InternalCard href={buildRepoUrl(repo.name)}> 58 - {#snippet children()} 59 - <GitBranch 60 - class="h-5 w-5 shrink-0 text-primary-600 dark:text-primary-400" 61 - aria-hidden="true" 62 - /> 63 - <div class="min-w-0 flex-1 space-y-2"> 64 - <h3 65 - class="overflow-wrap-anywhere font-semibold wrap-break-word text-ink-900 dark:text-ink-50" 66 - > 67 - {repo.name} 68 - </h3> 69 - <div 70 - class="flex flex-wrap items-center gap-3 text-xs text-ink-700 dark:text-ink-200" 71 - > 72 - <div class="flex min-w-0 items-center gap-1"> 73 - <Server class="h-3 w-3 shrink-0" aria-hidden="true" /> 74 - <span class="truncate">{getKnotServerName(repo.knot)}</span> 75 - </div> 76 - <div class="flex min-w-0 items-center gap-1"> 77 - <User class="h-3 w-3 shrink-0" aria-hidden="true" /> 78 - <span class="truncate">{handle || PUBLIC_ATPROTO_DID}</span> 79 - </div> 80 - </div> 81 - </div> 82 - <ExternalLink 83 - class="h-4 w-4 shrink-0 text-ink-700 transition-colors dark:text-ink-200" 84 - aria-hidden="true" 85 - /> 86 - {/snippet} 87 - </InternalCard> 88 - {/each} 89 - </div> 90 - {/snippet} 91 - </Card> 92 - {:else} 93 - <Card variant="flat" padding="lg"> 94 - {#snippet children()} 95 - <div class="text-center"> 96 - <p class="text-ink-700 dark:text-ink-300"> 97 - No Tangled repositories found. Create a <code 98 - class="rounded bg-canvas-200 px-1 dark:bg-canvas-800">sh.tangled.repo</code 99 - > record to display your repositories here. 100 - </p> 101 - <p class="mt-2 text-sm text-ink-600 dark:text-ink-400"> 102 - Learn more about Tangled at 103 - <a 104 - href="https://tangled.sh/" 105 - class="text-primary-600 hover:underline dark:text-primary-400" 106 - target="_blank" 107 - rel="noopener noreferrer">https://tangled.org/</a 108 - > 109 - </p> 110 - </div> 111 - {/snippet} 112 - </Card> 113 - {/if} 114 - </div>
+8 -1
src/lib/components/layout/main/card/index.ts
··· 3 3 // SupportersCard — local because it uses the app's own service layer. 4 4 export { default as SupportersCard } from './SupportersCard.svelte'; 5 5 // The rest are data-in, presentation-only — re-export from the package. 6 - export { LinkCard, ProfileCard, PostCard, TangledRepoCard, MusicStatusCard, KibunStatusCard, PopfeedCard } from '@ewanc26/ui'; 6 + export { 7 + LinkCard, 8 + ProfileCard, 9 + PostCard, 10 + MusicStatusCard, 11 + KibunStatusCard, 12 + PopfeedCard 13 + } from '@ewanc26/ui';
-1
src/lib/components/layout/main/index.ts
··· 1 1 // DynamicLinks uses the app's DID-bound fetchLinks wrapper — keep it local. 2 2 export { default as DynamicLinks } from './DynamicLinks.svelte'; 3 3 export { default as ScrollToTop } from './ScrollToTop.svelte'; 4 - export { default as TangledRepos } from './card/TangledRepoCard.svelte';
-1
src/lib/config/cache.config.server.ts
··· 26 26 LINKS: getEnvTTL('CACHE_TTL_LINKS', DEFAULT_CACHE_TTL.LINKS), 27 27 MUSIC_STATUS: getEnvTTL('CACHE_TTL_MUSIC_STATUS', DEFAULT_CACHE_TTL.MUSIC_STATUS), 28 28 KIBUN_STATUS: getEnvTTL('CACHE_TTL_KIBUN_STATUS', DEFAULT_CACHE_TTL.KIBUN_STATUS), 29 - TANGLED_REPOS: getEnvTTL('CACHE_TTL_TANGLED_REPOS', DEFAULT_CACHE_TTL.TANGLED_REPOS), 30 29 BLOG_POSTS: getEnvTTL('CACHE_TTL_BLOG_POSTS', DEFAULT_CACHE_TTL.BLOG_POSTS), 31 30 PUBLICATIONS: getEnvTTL('CACHE_TTL_PUBLICATIONS', DEFAULT_CACHE_TTL.PUBLICATIONS), 32 31 INDIVIDUAL_POST: getEnvTTL('CACHE_TTL_INDIVIDUAL_POST', DEFAULT_CACHE_TTL.INDIVIDUAL_POST),
-4
src/lib/config/cache.config.ts
··· 29 29 // Kibun status: 15 minutes (changes occasionally) 30 30 KIBUN_STATUS: dev ? 2 : 15, 31 31 32 - // Tangled repos: 60 minutes (changes occasionally) 33 - TANGLED_REPOS: dev ? 5 : 60, 34 - 35 32 // Blog posts: 30 minutes (balance between freshness and performance) 36 33 BLOG_POSTS: dev ? 5 : 30, 37 34 ··· 55 52 LINKS: DEFAULT_TTL.LINKS * 60 * 1000, 56 53 MUSIC_STATUS: DEFAULT_TTL.MUSIC_STATUS * 60 * 1000, 57 54 KIBUN_STATUS: DEFAULT_TTL.KIBUN_STATUS * 60 * 1000, 58 - TANGLED_REPOS: DEFAULT_TTL.TANGLED_REPOS * 60 * 1000, 59 55 BLOG_POSTS: DEFAULT_TTL.BLOG_POSTS * 60 * 1000, 60 56 PUBLICATIONS: DEFAULT_TTL.PUBLICATIONS * 60 * 1000, 61 57 INDIVIDUAL_POST: DEFAULT_TTL.INDIVIDUAL_POST * 60 * 1000,
+2 -7
src/lib/services/atproto/cache.ts
··· 15 15 if (key.startsWith('links:')) return CACHE_TTL.LINKS; 16 16 if (key.startsWith('music-status:')) return CACHE_TTL.MUSIC_STATUS; 17 17 if (key.startsWith('kibun-status:')) return CACHE_TTL.KIBUN_STATUS; 18 - if (key.startsWith('tangled:')) return CACHE_TTL.TANGLED_REPOS; 19 18 if (key.startsWith('blog-posts:') || key.startsWith('blogposts:')) return CACHE_TTL.BLOG_POSTS; 20 - if ( 21 - key.startsWith('publications:') || 22 - key.startsWith('standard-site:publications:') 23 - ) 19 + if (key.startsWith('publications:') || key.startsWith('standard-site:publications:')) 24 20 return CACHE_TTL.PUBLICATIONS; 25 - if (key.startsWith('post:') || key.startsWith('blueskypost:')) 26 - return CACHE_TTL.INDIVIDUAL_POST; 21 + if (key.startsWith('post:') || key.startsWith('blueskypost:')) return CACHE_TTL.INDIVIDUAL_POST; 27 22 if (key.startsWith('identity:')) return CACHE_TTL.IDENTITY; 28 23 return 30 * 60 * 1000; 29 24 }
-5
src/lib/services/atproto/fetch.ts
··· 7 7 fetchLinks as _fetchLinks, 8 8 fetchMusicStatus as _fetchMusicStatus, 9 9 fetchKibunStatus as _fetchKibunStatus, 10 - fetchTangledRepos as _fetchTangledRepos, 11 10 fetchRecentPopfeedReviews as _fetchRecentPopfeedReviews, 12 11 fetchSifaProfile as _fetchSifaProfile, 13 12 fetchSifaSkills as _fetchSifaSkills, ··· 41 40 42 41 export async function fetchKibunStatus(fetchFn?: typeof fetch) { 43 42 return _fetchKibunStatus(PUBLIC_ATPROTO_DID, fetchFn); 44 - } 45 - 46 - export async function fetchTangledRepos(fetchFn?: typeof fetch) { 47 - return _fetchTangledRepos(PUBLIC_ATPROTO_DID, fetchFn); 48 43 } 49 44 50 45 export async function fetchRecentPopfeedReviews(fetchFn?: typeof fetch) {
-3
src/lib/services/atproto/index.ts
··· 32 32 MusicStatusData, 33 33 MusicArtist, 34 34 KibunStatusData, 35 - TangledRepo, 36 - TangledReposData, 37 35 StandardSitePublication, 38 36 StandardSitePublicationsData, 39 37 StandardSiteDocument, ··· 62 60 fetchLinks, 63 61 fetchMusicStatus, 64 62 fetchKibunStatus, 65 - fetchTangledRepos, 66 63 fetchRecentPopfeedReviews, 67 64 fetchSifaProfile, 68 65 fetchSifaSkills,
-2
src/lib/services/atproto/types.ts
··· 27 27 MusicStatusData, 28 28 MusicArtist, 29 29 KibunStatusData, 30 - TangledRepo, 31 - TangledReposData, 32 30 StandardSitePublication, 33 31 StandardSitePublicationsData, 34 32 StandardSiteDocument,