Renders the site-wide chat in a modal, for signed-in users. ChatProvider
mounts it while the chat is open. It reads the history over GET /api/chat
and the live stream from WSChatContext, and writes through the latter.
Renders the chat, opening on focusId's message, or on the "new" divider,
when it is more than a screen above the bottom, else at the bottom. Reaching
the bottom of a visible tab moves the read marker. The draft and its reply target survive closing and reloading
(utils/chat/draft.ts). While it is open in a visible tab, the server sends
the user no notification for the mentions they see live.
Passed to ChatModal by ChatProvider.
-
focusId: string
The message to open on, from a
?chat=<id>deep link. Ignored when it isn't in the first page of history. -
onClose: () => void
Closes the chat, and drops the
?chat=deep link if there is one.
Usage
import * as mod from "src/components/chat/ChatModal.tsx";