blob: 734c07e2df4e32b00ae376250937e6775f8c40a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { TProject } from "@/types/project";
import { create } from "zustand";
interface ProjectStore {
activeProject: TProject | null;
// Actions
createNewProject: (name: string) => void;
closeProject: () => void;
}
export const useProjectStore = create<ProjectStore>((set) => ({
activeProject: null,
createNewProject: (name: string) => {
const newProject: TProject = {
id: crypto.randomUUID(),
name,
createdAt: new Date(),
updatedAt: new Date(),
};
set({ activeProject: newProject });
},
closeProject: () => {
set({ activeProject: null });
},
}));
|