diff --git a/client/src/Routes.tsx b/client/src/Routes.tsx
index 95ecb07..b90177b 100644
--- a/client/src/Routes.tsx
+++ b/client/src/Routes.tsx
@@ -1,26 +1,34 @@
+import { Suspense, lazy } from "react";
import { Navigate, Outlet, RouterProvider, createBrowserRouter } from "react-router-dom";
-import {
- DealerLayout,
- DealersList,
- ErrorPage,
- LoginPageWithLanguageSelector,
- LogoutPage,
- QuoteCreate,
- QuoteEdit,
- SettingsEditor,
- SettingsLayout,
-} from "./app";
-import { CatalogLayout, CatalogList } from "./app/catalog";
-import { DashboardPage } from "./app/dashboard";
-import { QuotesLayout } from "./app/quotes";
-import { QuotesList } from "./app/quotes/list";
-import { ProtectedRoute } from "./components";
+import { LoadingOverlay, ProtectedRoute } from "./components";
+
+// Lazy load components
+const DealerLayout = lazy(() => import("./app").then((m) => ({ default: m.DealerLayout })));
+const DealersList = lazy(() => import("./app").then((m) => ({ default: m.DealersList })));
+const ErrorPage = lazy(() => import("./app").then((m) => ({ default: m.ErrorPage })));
+const LoginPageWithLanguageSelector = lazy(() =>
+ import("./app").then((m) => ({ default: m.LoginPageWithLanguageSelector }))
+);
+const LogoutPage = lazy(() => import("./app").then((m) => ({ default: m.LogoutPage })));
+const QuoteCreate = lazy(() => import("./app").then((m) => ({ default: m.QuoteCreate })));
+const QuoteEdit = lazy(() => import("./app").then((m) => ({ default: m.QuoteEdit })));
+const SettingsEditor = lazy(() => import("./app").then((m) => ({ default: m.SettingsEditor })));
+const SettingsLayout = lazy(() => import("./app").then((m) => ({ default: m.SettingsLayout })));
+const CatalogLayout = lazy(() => import("./app").then((m) => ({ default: m.CatalogLayout })));
+const CatalogList = lazy(() => import("./app").then((m) => ({ default: m.CatalogList })));
+const DashboardPage = lazy(() => import("./app").then((m) => ({ default: m.DashboardPage })));
+const QuotesLayout = lazy(() => import("./app").then((m) => ({ default: m.QuotesLayout })));
+const QuotesList = lazy(() => import("./app").then((m) => ({ default: m.QuotesList })));
export const Routes = () => {
const routesForErrors = [
{
path: "*",
- Component: ErrorPage,
+ Element: (
+ }>
+
+
+ ),
},
];
@@ -38,71 +46,105 @@ export const Routes = () => {
path: "/home",
element: (
-
+ }>
+
+
),
},
{
path: "/catalog",
element: (
-
-
-
+ }>
+
+
+
+
),
children: [
{
index: true,
- element: ,
+ element: (
+ }>
+
+
+ ),
},
],
},
{
path: "/dealers",
element: (
-
-
-
+ }>
+
+
+
+
),
children: [
{
index: true,
- element: ,
+ element: (
+ }>
+
+
+ ),
},
],
},
{
path: "/quotes",
element: (
-
-
-
+ }>
+
+
+
+
),
children: [
{
index: true,
- element: ,
+ element: (
+ }>
+
+
+ ),
},
{
path: "add",
- element: ,
+ element: (
+ }>
+
+
+ ),
},
{
path: "edit/:id",
- element: ,
+ element: (
+ }>
+
+
+ ),
},
],
},
{
path: "/settings",
element: (
-
-
-
+ }>
+
+
+
+
),
children: [
{
index: true,
- element: ,
+ element: (
+ }>
+
+
+ ),
},
],
},
@@ -116,7 +158,11 @@ export const Routes = () => {
const routesForNotAuthenticatedOnly = [
{
path: "/login",
- Component: LoginPageWithLanguageSelector,
+ element: (
+ }>
+
+
+ ),
},
];
diff --git a/client/src/locales/en.json b/client/src/locales/en.json
index fce3b17..8aa988f 100644
--- a/client/src/locales/en.json
+++ b/client/src/locales/en.json
@@ -1,6 +1,7 @@
{
"translation": {
"common": {
+ "loading": "Loading...",
"required": "required",
"cancel": "Cancel",
"no": "No",
diff --git a/client/src/locales/es.json b/client/src/locales/es.json
index d0e2597..66f41ed 100644
--- a/client/src/locales/es.json
+++ b/client/src/locales/es.json
@@ -1,6 +1,7 @@
{
"translation": {
"common": {
+ "loading": "Cargando...",
"required": "obligatorio",
"cancel": "Cancelar",
"no": "No",