From 994e76313ee7e912da20d16ed8a2ea86a4ab8edf Mon Sep 17 00:00:00 2001 From: dtonon Date: Mon, 6 Apr 2026 17:19:38 +0100 Subject: [PATCH] Show full threads with replies --- src/lib/components/ThreadScrubber.svelte | 12 +- src/lib/thread.svelte.ts | 97 ++++++++++ src/routes/thread/[id]/+page.svelte | 217 +++++++++-------------- 3 files changed, 187 insertions(+), 139 deletions(-) create mode 100644 src/lib/thread.svelte.ts diff --git a/src/lib/components/ThreadScrubber.svelte b/src/lib/components/ThreadScrubber.svelte index daed377..a4c7645 100644 --- a/src/lib/components/ThreadScrubber.svelte +++ b/src/lib/components/ThreadScrubber.svelte @@ -1,9 +1,9 @@ - {thread?.title ?? "Thread"} + {detail?.title ?? "Thread"} -{#if thread} -
- +{#snippet avatar(author: Author)} + {#if author.picture} + + {:else} + + {author.name[0].toUpperCase()} + + {/if} +{/snippet} + +{#snippet post(p: PostData, bindEl: (el: HTMLElement | null) => void)} + {@const author = resolveAuthor(p.pubkey, profiles)} +
+
+ {@render avatar(author)} +
- - -
-

{thread.title}

- +
+ {author.name} + {formatDate(p.createdAt)} +
+
+ {#each p.content.split("\n\n") as para} +

{para}

+ {/each} +
+
+ +
+ + + +
+
+
+
+{/snippet} + +{#if detail} +
+
+
+

{detail.title}

- -
- {#each thread.tags as tag} - - {/each} +
+ {@render post(detail.op, () => {})}
- -
-
-
- {thread.op.author.name} -
-
-
- {thread.op.author.name} - {formatDate(thread.op.createdAt)} -
-
- {#each thread.op.content.split("\n\n") as para} -

{para}

- {/each} -
-
- -
- - - -
-
-
-
-
- - - {#if thread.op.replies && thread.op.replies.length > 0} + {#if detail.replies.length > 0}
- {#each thread.op.replies as reply, i} -
-
-
- {reply.author.name} -
-
-
- {reply.author.name} - {formatDate(reply.createdAt)} -
-

{reply.content}

-
- -
- - - -
-
-
-
+ {#each detail.replies as reply, i} +
+ {@render post(reply, () => {})}
{/each}
{/if} -
-
-
{:else} -
Thread not found.
+
Loading…
{/if}