import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; import { lazy, Suspense } from 'react'; import { MotionConfig } from 'framer-motion'; import Layout from './components/Layout.tsx'; // Lazy load pages to decrease initial bundle size const Dashboard = lazy(() => import('./pages/Dashboard.tsx')); const BaseMenu = lazy(() => import('./pages/BaseMenu.tsx')); const Products = lazy(() => import('./pages/Products.tsx')); const Orders = lazy(() => import('./pages/Orders.tsx')); const ArchivedOrders = lazy(() => import('./pages/ArchivedOrders.tsx')); const Customers = lazy(() => import('./pages/Customers.tsx')); const Login = lazy(() => import('./pages/Login.tsx')); const Managers = lazy(() => import('./pages/Managers.tsx')); const Stalls = lazy(() => import('./pages/Stalls.tsx')); const Staff = lazy(() => import('./pages/Staff.tsx')); const Terminals = lazy(() => import('./pages/Terminals.tsx')); const Vendors = lazy(() => import('./pages/Vendors.tsx')); const Purchases = lazy(() => import('./pages/Purchases.tsx')); const VendorDashboard = lazy(() => import('./pages/VendorDashboard.tsx')); const PurchaseAnalytics = lazy(() => import('./pages/PurchaseAnalytics.tsx')); const Bills = lazy(() => import('./pages/Bills.tsx')); const PurchaseSummary = lazy(() => import('./pages/PurchaseSummary.tsx')); const IntentDashboard = lazy(() => import('./pages/IntentDashboard.tsx')); const IntentList = lazy(() => import('./pages/IntentList.tsx')); const NewArrivals = lazy(() => import('./pages/NewArrivals.tsx')); const Reports = lazy(() => import('./pages/Reports.tsx')); const Feedback = lazy(() => import('./pages/Feedback.tsx')); const Ritz = lazy(() => import('./pages/Ritz.tsx')); const RitzCirculation = lazy(() => import('./pages/RitzCirculation.tsx')); const ManageWallets = lazy(() => import('./pages/ManageWallets.tsx')); const ManageCoupons = lazy(() => import('./pages/ManageCoupons.tsx')); const Settings = lazy(() => import('./pages/Settings.tsx')); const NotFound = lazy(() => import('./pages/NotFound.tsx')); const ProtectedRoute = ({ children }: { children: React.ReactNode }) => { const isLoggedIn = sessionStorage.getItem('isLoggedIn') === 'true'; return isLoggedIn ? <>{children} : ; }; const LoadingFallback = () => (
Loading...
); function App() { return ( }> } /> }> } /> } /> {/* Sale */} } /> } /> {/* Customers */} } /> {/* Purchases */} } /> } /> } /> } /> } /> } /> {/* Intent */} } /> } /> } /> } /> {/* Inventory */} } /> } /> } /> } /> {/* Others */} } /> } /> } /> } /> } /> } /> {/* Stores */} } /> } /> } /> } /> {/* Settings */} } /> } /> ); } export default App;