Skip to main content

Module comment_thread

Module comment_thread 

Source
Expand description

Ported from Arc (MIT) © 2026 Elia Kuratli Reference: Arc源码/arc-library/registry/components/comment-thread/comment-thread.tsx & .module.css

P6 Component #16: comment-thread

  • Nested threaded discussion panel:
    • Recursive replies capped at max_depth (default 2) hanging from a left rail;
    • Collapsible reply branches showing reply count and stacked participant avatars when folded;
    • Inline @Full Name mention highlighting for known participants (split_comment_mentions);
    • Reaction pills + inline reaction picker;
    • Author-only inline edit (swaps body for edit composer) and two-step delete confirmation (soft-deletes to a quiet placeholder if replies exist, or removes leaf comments cleanly);
    • Thread-level Resolve / Reopen morphing the full thread into a compact resolved chip.

Structs§

CommentAuthor
Author metadata for a comment or current user.
CommentReaction
Emoji reaction carrying the user ids who reacted.
CommentThread
Arc CommentThread — nested replies, @mention highlighting, inline edit/delete, and resolve chip.
ThreadComment
One node in the comment tree.

Constants§

COMMENT_DEFAULT_REACTIONS
Default emoji options in the comment reaction picker (comment-thread.tsx).

Functions§

append_comment_reply
Pure helper: attaches reply under reply_to_id clamped to max_depth (or root if None).
collect_comment_authors
Pure helper: collects unique non-deleted authors in appearance order.
count_comment_tree
Pure helper: counts all non-deleted comments in the tree.
delete_comment_in_tree
Pure helper: deletes a leaf comment, or soft-deletes a comment that still has replies.
edit_comment_in_tree
Pure helper: edits one comment body in place and marks edited = true.
path_to_comment
Pure helper: finds the path of comment IDs from root to target_id.
split_comment_mentions
Splits body text into (segment, is_mention) slices matching @Full Name of known authors.
toggle_comment_reaction
Pure helper: toggles user_id’s emoji reaction on comment id.