Add files via upload
This commit is contained in:
15
frontend/src/store/useToastStore.js
Normal file
15
frontend/src/store/useToastStore.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
let _id = 0
|
||||
|
||||
const useToastStore = create((set) => ({
|
||||
toasts: [],
|
||||
addToast: ({ message, undoFn, duration = 30 }) => {
|
||||
const id = ++_id
|
||||
set(s => ({ toasts: [...s.toasts, { id, message, undoFn, duration }] }))
|
||||
return id
|
||||
},
|
||||
removeToast: (id) => set(s => ({ toasts: s.toasts.filter(t => t.id !== id) })),
|
||||
}))
|
||||
|
||||
export default useToastStore
|
||||
13
frontend/src/store/useUIStore.js
Normal file
13
frontend/src/store/useUIStore.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
const useUIStore = create((set) => ({
|
||||
sidebarOpen: true,
|
||||
sidebarTab: 'projects', // 'projects' | 'agenda'
|
||||
showHeatmap: false,
|
||||
|
||||
toggleSidebar: () => set(s => ({ sidebarOpen: !s.sidebarOpen })),
|
||||
setSidebarTab: (tab) => set({ sidebarTab: tab }),
|
||||
toggleHeatmap: () => set(s => ({ showHeatmap: !s.showHeatmap })),
|
||||
}))
|
||||
|
||||
export default useUIStore
|
||||
Reference in New Issue
Block a user