import { useMemo } from 'react'; import { useMessages } from '../hooks/use-messages'; import { useMembers } from '../hooks/use-members'; import { Composer } from './composer'; import { MessageItem } from './message-item'; /** * The Slack-style thread side panel: the root message + its replies + a composer that posts back * into the thread (parentInteractionId = root). Uses its own useMessages on the same thread; the * shared adapter subscription keeps it and the main view in sync. */ export function ThreadPane({ threadId, rootId, onClose, }: { threadId: string; rootId: string; onClose: () => void; }) { const { messages, send, react, upload, seenIds, sendTyping, canReact, canUpload } = useMessages(threadId); const members = useMembers(threadId); const memberNames = useMemo(() => members.map((m) => m.name), [members]); const root = useMemo(() => messages.find((m) => m.id === rootId), [messages, rootId]); const replies = useMemo(() => messages.filter((m) => m.parentInteractionId === rootId), [messages, rootId]); return ( ); }