import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { AuthProvider, useAuth } from './contexts/AuthContext'; import Login from './pages/Login'; import Dashboard from './pages/Dashboard'; // Protected Route Component function ProtectedRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated } = useAuth(); if (!isAuthenticated) { return ; } return <>{children}; } // Public Route Component (redirect if already logged in) function PublicRoute({ children }: { children: React.ReactNode }) { const { isAuthenticated } = useAuth(); if (isAuthenticated) { return ; } return <>{children}; } function AppRoutes() { return ( } /> } /> } /> ); } function App() { return ( ); } export default App;