Skip to main content

Module chat_thread

Module chat_thread 

Source
Expand description

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

P6 Component #15: chat-thread

  • Full chat & support conversation thread:
    • Automatic day separators (Today, Yesterday, or UTC date) via zero-dependency civil calendar;
    • Consecutive messages by the same author within group_window_ms (default 5 min) share a group with softened inner corner radii (6px vs 18px), single header, and bottom-aligned author avatar;
    • Image & file attachment chips (format_chat_bytes);
    • Hoverable reaction trigger with inline emoji picker (👍 ❤️ 😂 🎉 👀 🙏), active pill state, and count toggling;
    • Delivery status (Sending / Sent / Delivered / Read / Not delivered + Retry button) and stacked reader avatars under the latest read message;
    • Animated 3-dot breathing typing indicator;
    • Built-in rounded composer powered by gpui_kit::component::input::{Input, InputState} with Enter-to-send and active send button morph.

Structs§

ChatAttachment
File or image attachment displayed inside a message bubble stack.
ChatMessage
One message in a ChatThread.
ChatParticipant
Participant in a ChatThread.
ChatReaction
Emoji reaction count under a ChatMessage.
ChatThread
Arc ChatThread — grouped chat messages, reactions, read receipts, typing dots, and composer.

Enums§

ChatAttachmentKind
Kind of attachment on a ChatMessage.
ChatMessageStatus
Delivery state of the current user’s own message.
ChatRow
Flattened render row produced by build_chat_rows.

Constants§

CHAT_DEFAULT_GROUP_WINDOW_MS
Default grouping window: 5 minutes in milliseconds.
CHAT_DEFAULT_REACTIONS
Default quick reaction set matching chat-thread.tsx.

Functions§

build_chat_rows
Groups chronological messages into day separators and first/last author runs.
format_chat_bytes
Formats byte sizes matching chat-thread.tsx (B / KB / MB).
format_chat_day
Formats a day separator label relative to now_ms.
format_chat_time
Formats HH:MM UTC clock time for a message timestamp.
toggle_chat_reaction
Toggles the current user’s reaction on a message’s reaction list.