import { Routes as BaseRoutes, Navigate, Route } from "react-router-dom"; import React, { lazy, Suspense } from "react"; import LoadingComponent from "./components/Loading"; import DashboardLayout from "./layouts/DashboardLayout"; // import RoleList from "./pages/RoleList"; // import AddEditRolePage from "./pages/AddEditRolePage"; // import VehicleList from "./pages/VehicleList"; // Page imports const Login = lazy(() => import("./pages/Auth/Login")); const SignUp = lazy(() => import("./pages/Auth/SignUp")); const LandingPage = lazy(() => import("./pages/LandingPage")); const Dashboard = lazy(() => import("./pages/Dashboard")); const VehicleList = lazy(() => import("./pages/VehicleList")); const AdminList = lazy(() => import("./pages/AdminList")); const ProfilePage = lazy(() => import("./pages/ProfilePage")); const NotFoundPage = lazy(() => import("./pages/NotFound")); const UserList = lazy(() => import("./pages/UserList")); const AddEditRolePage = lazy(() => import("./pages/AddEditRolePage")); const RoleList = lazy(() => import("./pages/RoleList")); const ManagerList = lazy(() => import("./pages/ManagerList")); const StationList = lazy(() => import("./pages/StationList")); const EVSlotManagement = lazy(() => import("./pages/EVSlotManagement")); const BookingList = lazy(() => import("./pages/BookingList")); const EvSlotList = lazy(() => import("./pages/EvSlotList")); const ExternalStationList = lazy( () => import("./pages/ExternalStationList/externalStationList.tsx") ); const AllManagersList = lazy(() => import("./pages/AllMangersList")); const AvailableSlotsList = lazy(() => import("./pages/AvailableSlotsList")); interface ProtectedRouteProps { // caps: string[]; component: React.ReactNode; } // Protected Route Component const ProtectedRoute: React.FC = ({ component }) => { if (!localStorage.getItem("authToken")) { return ; } return component; }; // Combined Router Component export default function AppRouter() { return ( }> {/* Default Route */} } /> {/* Auth Routes */} } /> } /> {/* Dashboard Routes */} }> } />} /> } />} /> } />} /> } />} /> } />} /> } />} /> } /> } /> } />} /> } />} /> } /> } /> } />} /> } />} /> } /> } /> } /> } /> } /> } /> {/* Catch-all Route */} } /> ); }