DRY up wall and reply rendering with ThreadedReplyList component

Extract shared ThreadedReplyList component and use it in PostDetailPage,
ExternalContentPage, and ProfilePage wall tab. Wall comments now also fetch
sub-replies via useComments so they render with the same threaded/threadedLast
connector-line pairing as replies.
This commit is contained in:
Chad Curtis
2026-03-01 04:01:01 -06:00
parent bc08f6d7de
commit 525317fe49
4 changed files with 53 additions and 21 deletions
+31
View File
@@ -0,0 +1,31 @@
import type { NostrEvent } from '@nostrify/nostrify';
import { NoteCard } from '@/components/NoteCard';
export interface ThreadedReply {
reply: NostrEvent;
firstSubReply?: NostrEvent;
}
interface ThreadedReplyListProps {
replies: ThreadedReply[];
}
/**
* Renders a flat list of replies where each top-level reply is optionally
* followed by its first sub-reply, using NoteCard's threaded/threadedLast
* connector-line styling for visual continuity.
*/
export function ThreadedReplyList({ replies }: ThreadedReplyListProps) {
return (
<>
{replies.map(({ reply, firstSubReply }) => (
<div key={reply.id}>
<NoteCard event={reply} threaded={!!firstSubReply} />
{firstSubReply && (
<NoteCard event={firstSubReply} threadedLast />
)}
</div>
))}
</>
);
}