diff --git a/src/lib/components/CommentViewer.svelte b/src/lib/components/CommentViewer.svelte new file mode 100644 index 0000000..b240aad --- /dev/null +++ b/src/lib/components/CommentViewer.svelte @@ -0,0 +1,316 @@ + + +
+ + Comments ({threadedComments.length}) + + + {#if loading} +
+

Loading comments...

+
+ {:else if error} +
+

{error}

+
+ {:else if threadedComments.length === 0} +
+

No comments yet. Be the first to comment!

+
+ {:else} +
+ {#each threadedComments as node (node.event.id)} +
+
+
+
+ + {getAuthorName(node.event.pubkey)} + + + {formatDate(node.event.created_at || 0)} Kind: {node.event.kind} + +
+
+ + {shortenNevent(getNeventUrl(node.event))} + + +
+
+ +
+ {@html node.event.content || ""} +
+
+ + {#if node.children.length > 0} + {#each node.children as childNode (childNode.event.id)} +
+
+
+
+ + {getAuthorName(childNode.event.pubkey)} + + + {formatDate(childNode.event.created_at || 0)} Kind: {childNode.event.kind} + +
+
+ + {shortenNevent(getNeventUrl(childNode.event))} + + +
+
+ +
+ {@html childNode.event.content || ""} +
+
+
+ {/each} + {/if} +
+ {/each} +
+ {/if} +
\ No newline at end of file diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte index 15c469c..65e0c43 100644 --- a/src/routes/events/+page.svelte +++ b/src/routes/events/+page.svelte @@ -8,6 +8,7 @@ import EventDetails from "$lib/components/EventDetails.svelte"; import RelayActions from "$lib/components/RelayActions.svelte"; import CommentBox from "$lib/components/CommentBox.svelte"; +import CommentViewer from "$lib/components/CommentViewer.svelte"; import { userStore } from "$lib/stores/userStore"; import { userBadge } from "$lib/snippets/UserSnippets.svelte"; import { getMatchingTags, toNpub } from "$lib/utils/nostrUtils"; @@ -810,6 +811,8 @@ + + {#if isLoggedIn && userPubkey}
Add Comment