- Add matrix-js-sdk, marked, highlight.js, twemoji, @tanstack/svelte-virtual deps - Copy Matrix core layer: /matrix/, /stores/matrix.ts, /cache/, /services/ - Copy Matrix components: matrix/, message/, chat-layout/, chat-settings/ - Copy UI components: EmojiPicker, Twemoji, ImagePreviewModal, VirtualList - Copy utils: emojiData, twemoji, twemojiGlobal - Replace lucide-svelte with Material Symbols in SyncRecoveryBanner - Extend Avatar with xs size and status indicator prop - Fix ui.ts store conflict: re-export toasts from toast.svelte.ts - Add migration 020_matrix_credentials for storing Matrix tokens per user/org - Add /api/matrix-credentials endpoint (GET/POST/DELETE) - Create [orgSlug]/chat page with Matrix login form + full chat UI - Add Chat to sidebar navigation
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
/**
|
|
* UI Stores
|
|
*
|
|
* Re-exports toasts from the main toast store for backward compatibility
|
|
* with Matrix components, plus Matrix-specific UI state.
|
|
*/
|
|
|
|
import { writable } from 'svelte/store';
|
|
|
|
// Re-export toasts so Matrix components can import from '$lib/stores/ui'
|
|
export { toasts } from '$lib/stores/toast.svelte';
|
|
|
|
// ============================================================================
|
|
// Chat Layout State
|
|
// ============================================================================
|
|
|
|
export const sidebarOpen = writable(true);
|
|
export const membersPanelOpen = writable(false);
|
|
|
|
// ============================================================================
|
|
// Chat Modals
|
|
// ============================================================================
|
|
|
|
export type ModalType =
|
|
| 'none'
|
|
| 'createRoom'
|
|
| 'roomSettings'
|
|
| 'roomMembers'
|
|
| 'userProfile'
|
|
| 'settings';
|
|
|
|
export const activeModal = writable<ModalType>('none');
|
|
export const modalData = writable<any>(null);
|
|
|
|
export function openModal(type: ModalType, data?: any): void {
|
|
activeModal.set(type);
|
|
modalData.set(data ?? null);
|
|
}
|
|
|
|
export function closeModal(): void {
|
|
activeModal.set('none');
|
|
modalData.set(null);
|
|
}
|
|
|
|
// ============================================================================
|
|
// Loading States
|
|
// ============================================================================
|
|
|
|
export const isLoading = writable(false);
|
|
export const loadingMessage = writable<string | null>(null);
|
|
|
|
export function setLoading(loading: boolean, message?: string): void {
|
|
isLoading.set(loading);
|
|
loadingMessage.set(message ?? null);
|
|
}
|