| 1 | import { create } from "zustand"; |
| 2 | |
| 3 | interface ContractStore { |
| 4 | analysisrResults: any; |
| 5 | setAnalysisResults: (results: any) => void; |
| 6 | } |
| 7 | |
| 8 | const useContractStore = create<ContractStore>((set) => ({ |
| 9 | analysisrResults: undefined, |
| 10 | setAnalysisResults: (results) => set({ analysisrResults: results }), |
| 11 | })); |
| 12 | |
| 13 | type ModalState = { |
| 14 | modals: Record<string, boolean>; |
| 15 | openModal: (key: string) => void; |
| 16 | closeModal: (key: string) => void; |
| 17 | isOpen: (key: string) => boolean; |
| 18 | }; |
| 19 | |
| 20 | const useModalStore = create<ModalState>((set, get) => ({ |
| 21 | modals: {}, |
| 22 | openModal: (key: string) => |
| 23 | set((state) => ({ modals: { ...state.modals, [key]: true } })), |
| 24 | closeModal: (key: string) => |
| 25 | set((state) => ({ modals: { ...state.modals, [key]: false } })), |
| 26 | isOpen: (key: string) => Boolean(get().modals[key]), |
| 27 | })); |
| 28 | |
| 29 | export { useContractStore, useModalStore }; |