Advertisement
ebleach7

Untitled

Mar 19th, 2024
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {
  2.   AboutPage,
  3.   AntiCorruption,
  4.   ContactsPage,
  5.   CooperationClientsPage,
  6.   CooperationInvestorsPage,
  7.   CooperationPage,
  8.   CooperationProcurementPage,
  9.   EmployeePage,
  10.   FaqPage,
  11.   HomePage,
  12.   HotlinePage,
  13.   NewsArticlePage,
  14.   NewsPage,
  15.   NotFoundPage,
  16.   ServicesCalculatorsPage,
  17.   ServicesPage,
  18.   ServicesTariffsPage,
  19.   TrackingPage,
  20.   TransRussia,
  21.   VacanciesPage,
  22. } from "@/pages";
  23. import { Suspense } from "react";
  24. import { Navigate, RouteObject } from "react-router-dom";
  25. import { AppLayout } from "../layouts";
  26.  
  27. const langFromLocalStorage = localStorage.getItem("i18nextLng");
  28.  
  29. const validateLang = ["ru", "kz", "en", "zh"].includes(
  30.   langFromLocalStorage || "",
  31. );
  32.  
  33. export const routes: RouteObject[] = [
  34.   {
  35.     element: <AppLayout />,
  36.     children: [
  37.       {
  38.         path: "/",
  39.         element: (
  40.           <Navigate
  41.             to={`${validateLang ? `/${langFromLocalStorage}` : "/kz"}`}
  42.           />
  43.         ),
  44.       },
  45.       {
  46.         path: ":lang",
  47.         children: [
  48.           {
  49.             path: "",
  50.             element: <HomePage />,
  51.           },
  52.           {
  53.             path: "faq",
  54.             element: <FaqPage />,
  55.           },
  56.           {
  57.             path: "news",
  58.             element: <NewsPage />,
  59.           },
  60.           {
  61.             path: "news/:articleId",
  62.             element: <NewsArticlePage />,
  63.           },
  64.           {
  65.             path: "hotline",
  66.             element: <HotlinePage />,
  67.           },
  68.           {
  69.             path: "vacancies",
  70.             element: <VacanciesPage />,
  71.           },
  72.           {
  73.             path: "about",
  74.             element: <AboutPage />,
  75.           },
  76.           {
  77.             path: "about/employee/:pageId/:employeeId",
  78.             element: <EmployeePage />,
  79.           },
  80.           {
  81.             path: "tracking",
  82.             element: <TrackingPage />,
  83.           },
  84.           {
  85.             path: "contacts",
  86.             element: (
  87.               <Suspense fallback={<div className="h-[600px]"></div>}>
  88.                 <ContactsPage />
  89.               </Suspense>
  90.             ),
  91.           },
  92.           {
  93.             path: "services",
  94.             element: <ServicesPage />,
  95.           },
  96.           {
  97.             path: "services/calculators",
  98.             element: <ServicesCalculatorsPage />,
  99.           },
  100.           {
  101.             path: "services/tariffs",
  102.             element: <ServicesTariffsPage />,
  103.           },
  104.           {
  105.             path: "cooperation",
  106.             element: <CooperationPage />,
  107.           },
  108.           {
  109.             path: "cooperation/clients",
  110.             element: <CooperationClientsPage />,
  111.           },
  112.           {
  113.             path: "cooperation/investors",
  114.             element: <CooperationInvestorsPage />,
  115.           },
  116.           {
  117.             path: "cooperation/procurement",
  118.             element: <CooperationProcurementPage />,
  119.           },
  120.           {
  121.             path: "anti-corruption",
  122.             element: <AntiCorruption />,
  123.           },
  124.           {
  125.             path: "TransRussia",
  126.             element: (
  127.               <Suspense fallback={<div className="h-[600px]"></div>}>
  128.                 <TransRussia />
  129.               </Suspense>
  130.             ),
  131.           },
  132.         ],
  133.       },
  134.       {
  135.         path: "*",
  136.         element: <NotFoundPage />,
  137.       },
  138.     ],
  139.   },
  140. ];
  141.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement