import { create } from 'zustand' export type ToastType = 'success' | 'error' | 'info' | 'warning' export interface Toast { id: string message: string type: ToastType } interface ToastState { toasts: Toast[] addToast: (message: string, type?: ToastType, duration?: number) => void removeToast: (id: string) => void } let counter = 0 export const useToastStore = create((set, get) => ({ toasts: [], addToast: (message, type = 'info', duration = 3500) => { const id = `toast-${++counter}` set((s) => ({ toasts: [...s.toasts, { id, message, type }] })) setTimeout(() => { get().removeToast(id) }, duration) }, removeToast: (id) => { set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })) }, }))