diff --git a/web/src/lib/components/profile/tabs/OverviewTab.svelte b/web/src/lib/components/profile/tabs/OverviewTab.svelte index 2e5d0113..e4884a6f 100644 --- a/web/src/lib/components/profile/tabs/OverviewTab.svelte +++ b/web/src/lib/components/profile/tabs/OverviewTab.svelte @@ -2,7 +2,7 @@ import RepoCard from "$lib/components/repo/RepoCard.svelte"; import Section from "$lib/components/ui/Section.svelte"; import ActivityStub from "../ActivityStub.svelte"; - import type { RepoCardData } from "../types"; + import { repoKey, type RepoCardData } from "../types"; interface Props { pinned: RepoCardData[]; @@ -18,7 +18,7 @@ empty={pinned.length === 0} emptyMessage="No pinned repositories." > - {#each pinned as repo (`${repo.repoDid}/${repo.name}`)} + {#each pinned as repo (repoKey(repo))} {/each} diff --git a/web/src/lib/components/profile/tabs/RepoListTab.svelte b/web/src/lib/components/profile/tabs/RepoListTab.svelte index d99344ac..2ecea30d 100644 --- a/web/src/lib/components/profile/tabs/RepoListTab.svelte +++ b/web/src/lib/components/profile/tabs/RepoListTab.svelte @@ -3,7 +3,7 @@ import { resolve } from "$app/paths"; import RepoCard from "$lib/components/repo/RepoCard.svelte"; import Section from "$lib/components/ui/Section.svelte"; - import type { RepoCardData } from "../types"; + import { repoKey, type RepoCardData } from "../types"; import Search from "$icon/search"; import X from "$icon/x"; @@ -43,7 +43,7 @@ {/snippet} - {#each repos as repo (`${repo.repoDid}/${repo.name}`)} + {#each repos as repo (repoKey(repo))} {/each} diff --git a/web/src/lib/components/profile/types.ts b/web/src/lib/components/profile/types.ts index dd53e552..06de652e 100644 --- a/web/src/lib/components/profile/types.ts +++ b/web/src/lib/components/profile/types.ts @@ -10,10 +10,12 @@ export interface ProfileCounts { } export interface RepoCardData { + rkey?: string; name: string; repoDid: string; ownerHandle: string; description?: string; + knot?: string; createdAt: string; language?: string; stars?: number; @@ -23,6 +25,9 @@ export interface RepoCardData { viewerStarRkey?: string | null; } +// legacy repos have no repoDid +export const repoKey = (repo: RepoCardData): string => repo.repoDid || repo.rkey || repo.name; + export interface StringCardData { rkey: string; ownerHandle: string; diff --git a/web/src/lib/components/repo/RepoHeader.svelte b/web/src/lib/components/repo/RepoHeader.svelte index 3ad46d9e..cddb075f 100644 --- a/web/src/lib/components/repo/RepoHeader.svelte +++ b/web/src/lib/components/repo/RepoHeader.svelte @@ -23,6 +23,7 @@ const signedIn = $derived(Boolean(auth.currentDid)); const base = $derived(`/${repo.ownerHandle}/${repo.name}`); const trimScheme = (url: string) => url.replace(/^https?:\/\//, "").replace(/\/$/, ""); + const topics = $derived([...new Set(repo.topics ?? [])]); {#snippet repoActions(className: string)} @@ -117,9 +118,9 @@ {/if} - {#if repo.topics?.length} + {#if topics.length}
- {#each repo.topics as topic (topic)} + {#each topics as topic (topic)} {topic} {/each}