feat: port the chat store, realtime client and components

- realtime.ts: the page's one Centrifuge client, setRealtimeAuth, onUserEvent for user:{me} events the chat does not handle
- chatEvents, chatFormat, chatText, chatUnread, format, media, tabs ported; copy passed in localized
- useChat over useState: channels with join and leave, DMs, member list, unread and mention counts, read marks, typing, presence, polling fallback
- ChatPanel, ChatHeader, ChatMessage, ChatDmList, ChatMemberPicker, ChatMentionPopup, ChatAvatar, ChatIcon, ChatNotices
- EN and PL strings
This commit is contained in:
Jakub Zych
2026-10-31 13:52:56 +01:00
parent fa6f9950a6
commit 5d581539b3
27 changed files with 3516 additions and 92 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
// The chat's short notices (a failed reaction, a refused pin, a download
// error): one message at a time, gone after a few seconds. ChatNotices
// renders it inside ChatPage and the floating panel. The message is an i18n
// key under chat. with optional parameters.
export interface ChatNotice {
key: string
params?: Record<string, unknown>
}
export function useChatNotice() {
const current = useState<ChatNotice | null>('chat:notice', () => null)
const nuxtApp = useNuxtApp() as unknown as { _chatNoticeTimer?: ReturnType<typeof setTimeout> }
function show(key: string, params?: Record<string, unknown>, ms = 4000) {
current.value = { key, params }
clearTimeout(nuxtApp._chatNoticeTimer)
nuxtApp._chatNoticeTimer = setTimeout(() => (current.value = null), ms)
}
function clear() {
clearTimeout(nuxtApp._chatNoticeTimer)
current.value = null
}
return { current, show, clear }
}