From 2eff70682cc9cef88216045e498cfec39b4823e1 Mon Sep 17 00:00:00 2001 From: Dale B Date: Wed, 21 Aug 2024 00:22:48 +0800 Subject: [PATCH] chore: add zustand global stores --- src/hooks/use-attendees-store.tsx | 15 +++++++++++++++ src/hooks/use-dialog-store.tsx | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/hooks/use-attendees-store.tsx create mode 100644 src/hooks/use-dialog-store.tsx diff --git a/src/hooks/use-attendees-store.tsx b/src/hooks/use-attendees-store.tsx new file mode 100644 index 0000000..c4049c0 --- /dev/null +++ b/src/hooks/use-attendees-store.tsx @@ -0,0 +1,15 @@ +import { Attendee } from "@/lib/types"; +import { create } from "zustand"; + +type AttendeesState = { + parsedAttendees: Attendee[]; + setParsedAttendees: (attendees: Attendee[]) => void; +}; + +export const useAttendeesStore = create()((set) => ({ + parsedAttendees: [] as Attendee[], + setParsedAttendees: (attendees) => + set(() => ({ + parsedAttendees: attendees, + })), +})); diff --git a/src/hooks/use-dialog-store.tsx b/src/hooks/use-dialog-store.tsx new file mode 100644 index 0000000..1904f49 --- /dev/null +++ b/src/hooks/use-dialog-store.tsx @@ -0,0 +1,11 @@ +import { create } from "zustand"; + +type DialogState = { + importDialog: boolean; + setImportDialog: (state: boolean) => void; +}; + +export const useDialogStore = create()((set) => ({ + importDialog: false, + setImportDialog: (state) => set(() => ({ importDialog: state })), +}));