import React, { createContext, useContext, useState, ReactNode } from 'react'; import { Toast, ToastContainer, useToast as useToastHook } from '../components/Toast'; interface ToastContextType { success: (message: string, duration?: number) => void; error: (message: string, duration?: number) => void; warning: (message: string, duration?: number) => void; info: (message: string, duration?: number) => void; } const ToastContext = createContext(undefined); export const ToastProvider: React.FC<{ children: ReactNode }> = ({ children }) => { const { toasts, closeToast, success, error, warning, info } = useToastHook(); return ( {children} ); }; export const useToast = () => { const context = useContext(ToastContext); if (!context) { throw new Error('useToast must be used within ToastProvider'); } return context; };