import React from 'react'; import { Routes, Route, useLocation, Navigate } from 'react-router-dom'; import "../pages/Dashboard.css"; import Sidebar from "../components/SideBar"; import Header from "../components/Header"; import { Box, Toolbar } from "@mui/material"; // GENERAL import Dasboard from '../pages/Dashboard'; import LoginPage from '../pages/Login'; import RegisterPage from '../pages/Register'; // ADMIN import ManageTransfers from '../pages/ManageTransfers'; import ManageNotifications from '../pages/ManageNotifications'; import ManageAccess from '../pages/ManageAccess'; import ManageAccounts from '../pages/ManageAccount'; import ManageGroups from '../pages/ManageGroups'; import ManageMembers from '../pages/ManageMembers'; import ManageMenus from '../pages/ManageMenu'; import MemberKyc from '../pages/MemberKYC'; import ManageCredential from '../pages/ManageCredential'; import ManageCurrency from '../pages/ManageCurrency'; import ManageWebservice from '../pages/ManageWebservice'; import SettingPage from '../pages/Setting'; // ESCROW import TransactionHistory from '../escrowPages/TransactionHistory'; import TransferPage from '../escrowPages/Transfer'; import TicketConfirmationPage from '../escrowPages/TicketConfirmation'; // Mock Authentication Function const isAuthenticated = () => { return localStorage.getItem("authToken") !== null; }; // Middleware Component for Protected Routes const ProtectedRoute = ({ children }) => { if (!isAuthenticated()) { return ; } return children; }; const Layout = ({ children }) => { const location = useLocation(); // Define routes where the Navbar should not appear const hideNavbarRoutes = ['/login', "/register"]; const shouldShowLayout = !hideNavbarRoutes.includes(location.pathname); return ( <> {shouldShowLayout && (
{children}
) } ); }; function App() { return ( {/* GENERAL */} } /> } /> } /> {/* ADMIN */} } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* ESCROW */} } /> } /> } /> ); } export default App;