admin / Bid-Sentinel
publicBid Scrape and Tracking Application with AI Capability
Bid-Sentinel / bid-sentinel-v2 / frontend / src / App.jsx
1249 B · main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { Navigate, Route, Routes } from "react-router-dom"; import { useAuth } from "./context/AuthContext.jsx"; import Login from "./pages/Login.jsx"; import Dashboard from "./pages/Dashboard.jsx"; import Settings from "./pages/Settings.jsx"; import Intelligence from "./pages/Intelligence.jsx"; function ProtectedRoute({ children }) { const { user, loading } = useAuth(); if (loading) { return ( <div className="flex h-full items-center justify-center text-slate-500"> Loading… </div> ); } return user ? children : <Navigate to="/login" replace />; } export default function App() { return ( <Routes> <Route path="/login" element={<Login />} /> <Route path="/" element={ <ProtectedRoute> <Dashboard /> </ProtectedRoute> } /> <Route path="/settings" element={ <ProtectedRoute> <Settings /> </ProtectedRoute> } /> <Route path="/intelligence" element={ <ProtectedRoute> <Intelligence /> </ProtectedRoute> } /> <Route path="*" element={<Navigate to="/" replace />} /> </Routes> ); } |