feat: implement comprehensive chat system with user presence management, notification handling, and avatar integration; enhance UI components for improved user experience
This commit is contained in:
42
apps/web/src/lib/stores/chatStore.ts
Normal file
42
apps/web/src/lib/stores/chatStore.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { writable, derived } from 'svelte/store';
|
||||
import type { Id } from '@sgse-app/backend/convex/_generated/dataModel';
|
||||
|
||||
// Store para a conversa ativa
|
||||
export const conversaAtiva = writable<Id<"conversas"> | null>(null);
|
||||
|
||||
// Store para o estado do chat (aberto/minimizado/fechado)
|
||||
export const chatAberto = writable<boolean>(false);
|
||||
export const chatMinimizado = writable<boolean>(false);
|
||||
|
||||
// Store para o contador de notificações
|
||||
export const notificacoesCount = writable<number>(0);
|
||||
|
||||
// Funções auxiliares
|
||||
export function abrirChat() {
|
||||
chatAberto.set(true);
|
||||
chatMinimizado.set(false);
|
||||
}
|
||||
|
||||
export function fecharChat() {
|
||||
chatAberto.set(false);
|
||||
chatMinimizado.set(false);
|
||||
conversaAtiva.set(null);
|
||||
}
|
||||
|
||||
export function minimizarChat() {
|
||||
chatMinimizado.set(true);
|
||||
}
|
||||
|
||||
export function maximizarChat() {
|
||||
chatMinimizado.set(false);
|
||||
}
|
||||
|
||||
export function abrirConversa(conversaId: Id<"conversas">) {
|
||||
conversaAtiva.set(conversaId);
|
||||
abrirChat();
|
||||
}
|
||||
|
||||
export function voltarParaLista() {
|
||||
conversaAtiva.set(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user