import { Routes, Route, Link, useLocation } from 'react-router-dom'; import { RecipeListPage } from './pages/RecipeListPage'; import { RecipeDetailPage } from './pages/RecipeDetailPage'; import { CookModePage } from './pages/CookModePage'; import { NotFoundPage } from './pages/NotFoundPage'; import { ImportUrlPage } from './pages/ImportUrlPage'; import { ErrorBoundary } from './components/ErrorBoundary'; import { ToastContainer } from './components/Toast'; import { useToast } from './hooks/useToast'; import { createContext, useContext } from 'react'; // Create toast context to share toast functionality across the app interface ToastContextType { success: (message: string, duration?: number) => string; error: (message: string, duration?: number) => string; info: (message: string, duration?: number) => string; warning: (message: string, duration?: number) => string; } const ToastContext = createContext(null); export function useToastContext() { const context = useContext(ToastContext); if (!context) { throw new Error('useToastContext must be used within ToastProvider'); } return context; } function App() { const location = useLocation(); const toast = useToast(); const isActive = (path: string) => { if (path === '/' && location.pathname === '/') return true; if (path !== '/' && location.pathname.startsWith(path)) return true; return false; }; const linkClass = (path: string) => { const base = "px-3 py-2 rounded-md text-sm font-medium transition-colors"; return isActive(path) ? `${base} bg-blue-100 text-blue-700` : `${base} text-gray-700 hover:bg-gray-100`; }; return (

Recipe Manager

} /> } /> } /> } /> } /> } />
); } export default App;