diff --git a/src/lib/thread.svelte.ts b/src/lib/thread.svelte.ts index 1dc40f4..dcf2924 100644 --- a/src/lib/thread.svelte.ts +++ b/src/lib/thread.svelte.ts @@ -16,6 +16,7 @@ export type PostData = { type ThreadDetail = { id: string; title: string; + labels: string[]; op: PostData; replies: PostData[]; }; @@ -41,6 +42,7 @@ function loadMockThread(id: string) { detail = { id: t.id, title: t.title, + labels: t.tags.map((tag) => tag.label), op: { id: t.op.id, pubkey: t.op.author.pubkey, createdAt: toUnix(t.op.createdAt), content: t.op.content }, replies: (t.op.replies ?? []).map((r) => ({ id: r.id, pubkey: r.author.pubkey, createdAt: toUnix(r.createdAt), content: r.content, @@ -77,6 +79,7 @@ export async function loadThread(id: string) { detail = { id: event.id, title: event.tags.find((t) => t[0] === "title")?.[1] ?? "(untitled)", + labels: event.tags.filter((t) => t[0] === "t" && t[1]).map((t) => t[1]), op: { id: event.id, pubkey: event.pubkey, diff --git a/src/routes/room/[slug]/+page.svelte b/src/routes/room/[slug]/+page.svelte index 47595ca..7fee418 100644 --- a/src/routes/room/[slug]/+page.svelte +++ b/src/routes/room/[slug]/+page.svelte @@ -22,6 +22,7 @@ return { id: t.id, title: t.title, + labels: t.tags.map((tag) => tag.label), author: t.op.author, replyCount: t.replyCount, repliers: t.participants diff --git a/src/routes/thread/[id]/+page.svelte b/src/routes/thread/[id]/+page.svelte index 44274f7..a6e87fa 100644 --- a/src/routes/thread/[id]/+page.svelte +++ b/src/routes/thread/[id]/+page.svelte @@ -13,6 +13,7 @@ import ThreadScrubber from "$lib/components/ThreadScrubber.svelte"; import MessageEditor from "$lib/components/MessageEditor.svelte"; import PostContent from "$lib/components/PostContent.svelte"; + import Tag from "$lib/components/Tag.svelte"; import { type NostrUser } from "@nostr/gadgets/metadata"; type Author = { pubkey: string; name: string; picture?: string }; @@ -150,17 +151,25 @@

{detail.title}

-
+ {#if isScrolled} +
+ {/if}
+ {#if detail.labels.length > 0} +
+ {#each detail.labels as l} + + {/each} +
+ {/if} +
{@render post(detail.op, () => {})}