import React from "react"; import { Navigate, createBrowserRouter, useParams } from "react-router-dom"; import App from "./App"; import { useAuth } from "./context/AuthContext"; /** * Code-splitting: client-facing pages (opened from SMS links on mobile) load a * small chunk instead of the full 932KB bundle that includes the staff * dashboard, admin panels, etc. This fixes 30-40s loads on slow mobile * connections (customers in Crimea opening delivery links). * * Staff pages are also lazy so the login page stays light. */ const ClientDeliveryPage = React.lazy(() => import("./pages/ClientDeliveryPage").then((m) => ({ default: m.ClientDeliveryPage })) ); const ClientTestPage = React.lazy(() => import("./pages/ClientTestPage").then((m) => ({ default: m.ClientTestPage })) ); const ClientTestConsentPage = React.lazy(() => import("./pages/ClientTestConsentPage").then((m) => ({ default: m.ClientTestConsentPage })) ); const DashboardPage = React.lazy(() => import("./pages/DashboardPage").then((m) => ({ default: m.DashboardPage })) ); const GroupDetailPage = React.lazy(() => import("./pages/GroupDetailPage").then((m) => ({ default: m.GroupDetailPage })) ); const LoginPage = React.lazy(() => import("./pages/LoginPage").then((m) => ({ default: m.LoginPage })) ); const NotFoundPage = React.lazy(() => import("./pages/NotFoundPage").then((m) => ({ default: m.NotFoundPage })) ); const ForbiddenPage = React.lazy(() => import("./pages/ForbiddenPage").then((m) => ({ default: m.ForbiddenPage })) ); const SettingsPage = React.lazy(() => import("./pages/SettingsPage").then((m) => ({ default: m.SettingsPage })) ); const PageLoader = () => (