import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; import { AuthProvider, useAuth } from './context/AuthContext'; import Login from './pages/Login'; import Register from './pages/Register'; import Dashboard from './pages/Dashboard'; import ProductDetail from './pages/ProductDetail'; function ProtectedRoute({ children }: { children: React.ReactNode }) { const { user, isLoading } = useAuth(); if (isLoading) { return (
); } if (!user) { return ; } return <>{children}; } function PublicRoute({ children }: { children: React.ReactNode }) { const { user, isLoading } = useAuth(); if (isLoading) { return (
); } if (user) { return ; } return <>{children}; } function AppRoutes() { return ( } /> } /> } /> } /> } /> ); } export default function App() { return ( ); }