Files
xiaoxia-saas/apps/web/src/store/uiStore.ts
T
Xiaoxia AI 2cda8dec39
Deploy / Deploy Staging (push) Failing after 9s
Deploy / Deploy Production (push) Has been skipped
Tests / test (push) Failing after 14s
Tests / lint (push) Failing after 15s
fix: connect API to tracker.db via SQLite repository
2026-06-17 13:21:38 +08:00

33 lines
682 B
TypeScript

/**
* UI 状态管理
* 管理全局 UI 状态(侧边栏、加载状态等)
*/
import { create } from 'zustand';
interface UIState {
sidebarCollapsed: boolean;
loading: boolean;
// Actions
toggleSidebar: () => void;
setSidebarCollapsed: (collapsed: boolean) => void;
setLoading: (loading: boolean) => void;
}
export const useUIStore = create<UIState>((set) => ({
sidebarCollapsed: false,
loading: false,
toggleSidebar: () => {
set((state) => ({ sidebarCollapsed: !state.sidebarCollapsed }));
},
setSidebarCollapsed: (collapsed) => {
set({ sidebarCollapsed: collapsed });
},
setLoading: (loading) => {
set({ loading });
},
}));