import type { CommentAttachment } from '~~/shared/utils/attachments' export interface LiveComment { id: number content: string createdAt: string userName: string userId: number userColor: string | null userAvatarUrl: string | null uploadId: string attachments?: CommentAttachment[] } export function useLiveComments() { const liveComments = useState('comments:live', () => []) function pushLive(comment: LiveComment) { if (liveComments.value.some(c => c.id === comment.id)) return liveComments.value = [comment, ...liveComments.value].slice(0, 50) } return { liveComments, pushLive } }