import { createContext, useContext, type ReactNode } from 'react'; import { useToast, type Toast } from '../hooks/useToast'; interface ToastContextValue { toasts: Toast[]; showToast: (message: string, type?: Toast['type']) => void; removeToast: (id: number) => void; } const ToastContext = createContext(null); export function ToastProvider({ children }: { children: ReactNode }) { const { toasts, showToast, removeToast } = useToast(); return ( {children} ); } // eslint-disable-next-line react-refresh/only-export-components export function useToastContext(): ToastContextValue { const ctx = useContext(ToastContext); if (!ctx) { throw new Error('useToastContext must be used within a ToastProvider'); } return ctx; }