Initial commit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Christoph K.
2026-03-21 15:03:55 +01:00
commit dfd66e43c6
78 changed files with 6219 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import { create } from 'zustand';
export interface Toast {
id: string;
type: 'success' | 'error' | 'info';
message: string;
}
interface ToastState {
toasts: Toast[];
addToast: (type: Toast['type'], message: string) => void;
removeToast: (id: string) => void;
}
export const useToastStore = create<ToastState>((set) => ({
toasts: [],
addToast: (type, message) => {
const id = crypto.randomUUID();
set((state) => ({
toasts: [...state.toasts, { id, type, message }],
}));
setTimeout(() => {
set((state) => ({
toasts: state.toasts.filter((t) => t.id !== id),
}));
}, 3000);
},
removeToast: (id) => {
set((state) => ({
toasts: state.toasts.filter((t) => t.id !== id),
}));
},
}));