diff --git a/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx b/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx index 47d662477..c56dca6c8 100644 --- a/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx +++ b/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx @@ -45,65 +45,91 @@ export function CommentThread({ setIsReplyComposerOpen(false); }; + const hasReplies = thread.replies.length > 0; + const showReplies = thread.replies.length === 1 || isRepliesExpanded; + return ( -
+
+ {/* Parent comment */} onEditComment(id, "")} onDelete={onDeleteComment} /> - {thread.replies.length > 1 && ( -
- )} - {thread.replies.length} replies - + + {/* Reply items */} + {showReplies && hasReplies && ( +
+ {thread.replies.map((reply) => ( + onEditComment(id, "")} + onDelete={onDeleteComment} + /> + ))} +
+ )} + + {/* Reply composer or button */} + {isReplyComposerOpen ? ( + + ) : ( + + )} +
)} - {thread.replies.length > 0 && (thread.replies.length === 1 || isRepliesExpanded) && ( -
- {thread.replies.map((reply) => ( - onEditComment(id, "")} - onDelete={onDeleteComment} - /> - ))} -
- )} - -
- {isReplyComposerOpen ? ( - - ) : ( - - )} -
+
+ )} ); }