// 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 } export function useChatNotice() { const current = useState('chat:notice', () => null) const nuxtApp = useNuxtApp() as unknown as { _chatNoticeTimer?: ReturnType } function show(key: string, params?: Record, 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 } }