import React from "react"; import { BrowserRouter as Router, Routes, Route, Navigate } from "react-router-dom"; import Home from "./pages/home"; import Dashboard from "./pages/dashboard"; import Notes from "./pages/note"; import AIInterview from "./pages/AiInterview"; import Quize from "./pages/quize"; import Sidebar from "./components/dashboard/Sidebar"; import { AuthProvider, useAuth } from "./components/context/AuthContext"; import ProtectedRoute from "./routes/ProtectedRoute"; const DashboardLayout = () => { // 1. Retrieve both logout and username from the AuthContext return (
{/* 2. Pass the retrieved username prop to the Sidebar */}
} /> } /> } /> } /> } />
); }; const App: React.FC = () => { return ( {/* Public Home */} } /> {/* Protected all dashboard routes */} } /> ); }; const HomeWrapper = () => { const { isAuthenticated, login } = useAuth(); if (isAuthenticated) return ; return ; }; export default App;