Backend: - Add dashboard API (today stats, inbox count, law alerts, pipeline status) - Add /api/documents/tree endpoint for sidebar domain/sub_group tree - Migrate auth to HttpOnly cookie for refresh token (XSS defense) - Add /api/auth/logout endpoint (cookie cleanup) - Register dashboard router in main.py Frontend (SvelteKit + Tailwind CSS v4): - api.ts: fetch wrapper with refresh queue pattern, 401 single retry, forced logout on refresh failure - Auth store: login/logout/refresh with memory-based access token - UI store: toast system, sidebar state - Login page with TOTP support - Dashboard with 4 stat widgets + recent documents - Document list with hybrid search (debounce, URL query state, mode select) - Document detail with format-aware viewer (markdown/PDF/HWP/Synology/fallback) - Metadata panel (AI summary, tags, processing history) - Inbox triage UI (batch select, confirm dialog, domain override) - Settings page (password change, TOTP status) Infrastructure: - Enable frontend service in docker-compose - Caddy path routing (/api/* → fastapi, / → frontend) + gzip Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
684 B
TypeScript
28 lines
684 B
TypeScript
import { writable } from 'svelte/store';
|
|
|
|
export const sidebarOpen = writable(true);
|
|
export const selectedDocId = writable<number | null>(null);
|
|
|
|
// Toast 시스템
|
|
interface Toast {
|
|
id: number;
|
|
type: 'success' | 'error' | 'warning' | 'info';
|
|
message: string;
|
|
}
|
|
|
|
let toastId = 0;
|
|
export const toasts = writable<Toast[]>([]);
|
|
|
|
export function addToast(type: Toast['type'], message: string, duration = 5000) {
|
|
const id = ++toastId;
|
|
toasts.update(t => [...t, { id, type, message }]);
|
|
if (duration > 0) {
|
|
setTimeout(() => removeToast(id), duration);
|
|
}
|
|
return id;
|
|
}
|
|
|
|
export function removeToast(id: number) {
|
|
toasts.update(t => t.filter(toast => toast.id !== id));
|
|
}
|