| 1 | import { create } from 'zustand'; |
| 2 | |
| 3 | interface UIState { |
| 4 | isSidebarOpen: boolean; |
| 5 | activeModal: string | null; |
| 6 | |
| 7 | toggleSidebar: () => void; |
| 8 | setSidebarOpen: (open: boolean) => void; |
| 9 | openModal: (modalId: string) => void; |
| 10 | closeModal: () => void; |
| 11 | } |
| 12 | |
| 13 | export const useUIStore = create<UIState>((set) => ({ |
| 14 | isSidebarOpen: false, |
| 15 | activeModal: null, |
| 16 | |
| 17 | toggleSidebar: () => |
| 18 | set((state) => ({ isSidebarOpen: !state.isSidebarOpen })), |
| 19 | setSidebarOpen: (open: boolean) => set({ isSidebarOpen: open }), |
| 20 | openModal: (modalId: string) => set({ activeModal: modalId }), |
| 21 | closeModal: () => set({ activeModal: null }), |
| 22 | })); |