import { createBrowserRouter, RouterProvider } from "react-router-dom"; import React, { Suspense } from "react"; import { ThemeProvider } from "./context/ThemeContext"; import "./App.css"; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; // Lazy loading the pages and components const Login = React.lazy(() => import("./pages/Login/Login")); const Root = React.lazy(() => import("./components/DashboardRoot/Root")); const Dashboard = React.lazy(() => import("./pages/Dashboard/Dashboard")); const Form = React.lazy(() => import("./pages/ApplicationForm/Form")); const About = React.lazy(() => import("./pages/About/About")); const Policy = React.lazy(() => import("./pages/Policy/Policy")); const Applications = React.lazy(() => import("./pages/Applications/Applications")); const Report = React.lazy(() => import("./pages/Report/Report")); const LoginRoot = React.lazy(() => import("./components/LoginRoot/LoginRoot")); const ContactUs = React.lazy(() => import("./pages/ContactUs/ContactUs")); const ApplicationView = React.lazy(() => import("./pages/ApplicationView/ApplicationView") ); const Settings = React.lazy(() => import("./pages/Settings/Settings")); import userDataLoader from "./services/userDataLoader"; import { upsertApplicationAction } from "./services/upsertApplicationAction"; import { applicationStatusAction } from "./services/applicationStatusAction"; import Loading from "./components/Loading"; // Define the router with lazy-loaded components const router = createBrowserRouter([ { path: "/", element: , children: [ { index: true, element: }, { path: "about", element: }, { path: "policy", element: }, ], }, { path: "/applicant", element: , id: "Applicant-Root", loader: userDataLoader, children: [ { path: "dashboard", element: }, { path: "dashboard/:status", element: }, { path: "dashboard/:status/:applicationId", element: , action: upsertApplicationAction, }, { path: "form", element:
, action: upsertApplicationAction }, { path: "contact-us", element: }, { path: "settings", element: }, { path: "policy", element: }, ], }, { path: "/validator", element: , id: "Validator-Root", loader: userDataLoader, children: [ { path: "dashboard", element: }, { path: "dashboard/:status", element: }, { path: "dashboard/:status/:applicationId", element: , action: applicationStatusAction, }, { path: "report", element: }, { path: "settings", element: }, { path: "policy", element: }, ], }, ]); function App() { return ( }> ); } export default App;