app page
import { Suspense } from "react";
import { CookiesProvider } from "react-cookie";
import { ThemeProvider } from "@ebh/capsule/theme";
import { THEME_COLORS } from "./theme/color";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import GuestRoutes from "./modules/layout/guest-routes.tsx";
import LoadingScreen from "./modules/loading-screen.tsx";
import ErrorBoundary from "./modules/error-boundary.tsx";
import { TPAEnrollmentProvider } from "./context/use-tpa-enrollment-context.tsx";
import ProtectedRoute from "./common/protected-route/index.tsx";
import lazyLoadingRoutes from "./utils/lazy-loading-routes.ts";
import SecondOpinionHome from "./modules/second-opinion/index.tsx";
import SecondOpinion from "./modules/second-opinion/treatement-details-form/index.tsx";
import SecondMedicalPatientDetail from "./modules/second-opinion/second-medical-patient-detail/index.tsx";
import SecondMedicalSummaryDetail from "./modules/second-opinion/second-medical-summary-detail/index.tsx";
import AppointmentHistory from "./modules/second-opinion/appoinments-history-mobile/index.tsx";
import AskQueryHome from './modules/first-opinion/index.tsx'
// Add all routes inside lazyLoadingRoutes.
const {
Home,
Submit,
NewClaimSubmissionIpd,
HealthBlog,
HealthBlogDetails,
LoginPage,
NewClaimSubmissionOpd,
Intimation,
IntimationHistory,
IPDClaimHistory,
TermsandConditions,
ViewAllDrafts,
OPDClaimHistory,
OPDClaimSubmission,
LandingPage,
OpdIpdPage,
IPDClaimSubmissionPage,
CashlessHistory,
Feedback,
HealthCheckUp,
AppointmentHistoryMobile,
SelectCityOrPincode,
SelectProvider,
SelectDateTime,
AddAddress,
AppointmentSummary,
HelpCenter,
AppointmentConfirmation,
} = lazyLoadingRoutes;
// Group related features into feature bundles
const BASE_PATH = import.meta.env.VITE_BASE_URL || "/";
const queryClient = new QueryClient();
const router = createBrowserRouter(
[
{
path: "/vhc-portal",
element: (
<TPAEnrollmentProvider>
<ProtectedRoute />
</TPAEnrollmentProvider>
),
hydrateFallbackElement: <LoadingScreen />,
children: [
{
path: "home",
element: <Home />,
},
{
path: "submit",
element: <Submit />,
},
{
path: "opdipd",
element: <OpdIpdPage />,
},
{
path: "feedback",
element: <Feedback />,
},
{
path: "claims",
children: [
{
path: "ipd",
element: <IPDClaimSubmissionPage />,
},
{
path: "opd",
element: <OPDClaimSubmission />,
},
{
path: "ipd/submitclaim",
element: <NewClaimSubmissionIpd />,
},
{
path: "opd/submitclaim",
element: <NewClaimSubmissionOpd />,
},
{
path: "ipd/view-all",
element: <ViewAllDrafts />,
},
{
path: "opd/view-all",
element: <ViewAllDrafts />,
},
{
path: "ipd/history",
element: <IPDClaimHistory />,
},
{
path: "opd/history",
element: <OPDClaimHistory />,
},
{
path: "cashless-history",
element: <CashlessHistory />,
},
],
},
{
path: "healthblog",
children: [
{
index: true,
element: <HealthBlog />,
},
{
path: ":blogFile",
element: <HealthBlogDetails />,
},
],
},
{
path: "secondopinion",
children: [
{
index: true,
element: <SecondOpinionHome/>,//SecondOpinionHome
},
{
path: "treatmentdetails",
element: <SecondOpinion/>,
},
{
path: "patientdetail",
element: <SecondMedicalPatientDetail />,
},
{
path: "summarydetail",
element: <SecondMedicalSummaryDetail />,
},
{
path:"appointmentHistory/:query",
element:<AppointmentHistory/>,
}
],
},
{
path: "ask-query",
children: [
{
index: true,
element: <AskQueryHome/>,//AskQueryHome
},]
},
{
path: "intimation",
children: [
{
index: true,
element: <IntimationHistory />,
},
{
path: "history",
element: <Intimation />,
},
],
},
{
path: "reimbursement",
element: <LandingPage />,
},
// Health Checkup
{
path: "health-check-up", // http://localhost:5173/vhc-portal/health-check-up?email=vuppu.lokraj@vidalhealth.com&mobile=9959730629&corporateId=NIIT&patientSlug=puxrCKGL3Ce2XIdIcrR7bpQn&token=abecd8b265c10e307d8b4126c29cf2ee35ad0b02
children: [
{ index: true, element: <HealthCheckUp /> },
{ path: "history-mobile", element: <AppointmentHistoryMobile /> },
{
path: "select-city-or-pincode",
element: <SelectCityOrPincode />,
},
{ path: "select-provider", element: <SelectProvider /> },
{ path: "select-date-and-time", element: <SelectDateTime /> },
{ path: "add-address", element: <AddAddress /> },
{ path: "appointment-summary", element: <AppointmentSummary /> },
{ path: "help-center", element: <HelpCenter /> },
{ path: "confirmation", element: <AppointmentConfirmation /> },
],
},
],
},
{
element: <GuestRoutes />,
path: "/vhc-portal",
hydrateFallbackElement: <LoadingScreen />,
children: [
{
path: "login",
element: <LoginPage />,
},
{
path: "terms-and-conditions",
element: <TermsandConditions />,
},
],
},
],
{ basename: BASE_PATH }
);
function App() {
return (
<ErrorBoundary
onError={(error) => {
console.error("Caught an error:", error);
}}
>
<Suspense fallback={<LoadingScreen />}>
<CookiesProvider>
<QueryClientProvider client={queryClient}>
<ThemeProvider themeKey="vidal-vhc-portal" colors={THEME_COLORS}>
<RouterProvider router={router} />
</ThemeProvider>
</QueryClientProvider>
</CookiesProvider>
</Suspense>
</ErrorBoundary>
);
}
export default App;
Comments
Post a Comment