diff --git a/Client/src/App.jsx b/Client/src/App.jsx
index 82c8203a8..b27373071 100644
--- a/Client/src/App.jsx
+++ b/Client/src/App.jsx
@@ -1,37 +1,9 @@
import { useEffect } from "react";
-import { Routes, Route, Navigate } from "react-router-dom";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
import "react-toastify/dist/ReactToastify.css";
import { ToastContainer } from "react-toastify";
-import NotFound from "./Pages/NotFound";
-import Login from "./Pages/Auth/Login";
-import Register from "./Pages/Auth/Register/Register";
-import Account from "./Pages/Account";
-import Monitors from "./Pages/Monitors/Home";
-import CreateMonitor from "./Pages/Monitors/CreateMonitor";
-import CreateInfrastructureMonitor from "./Pages/Infrastructure/CreateMonitor";
-import Incidents from "./Pages/Incidents";
-import Status from "./Pages/Status";
-import Integrations from "./Pages/Integrations";
-import Settings from "./Pages/Settings";
-import ForgotPassword from "./Pages/Auth/ForgotPassword";
-import CheckEmail from "./Pages/Auth/CheckEmail";
-import SetNewPassword from "./Pages/Auth/SetNewPassword";
-import NewPasswordConfirmed from "./Pages/Auth/NewPasswordConfirmed";
-import ProtectedRoute from "./Components/ProtectedRoute";
-import Details from "./Pages/Monitors/Details";
-import AdvancedSettings from "./Pages/AdvancedSettings";
-import Maintenance from "./Pages/Maintenance";
-import Configure from "./Pages/Monitors/Configure";
-import PageSpeed from "./Pages/PageSpeed";
-import CreatePageSpeed from "./Pages/PageSpeed/CreatePageSpeed";
-import CreateNewMaintenanceWindow from "./Pages/Maintenance/CreateMaintenance";
-import PageSpeedDetails from "./Pages/PageSpeed/Details";
-import PageSpeedConfigure from "./Pages/PageSpeed/Configure";
-import HomeLayout from "./Components/Layouts/HomeLayout";
-import withAdminCheck from "./Components/HOC/withAdminCheck";
-import withAdminProp from "./Components/HOC/withAdminProp";
+
import { ThemeProvider } from "@emotion/react";
import lightTheme from "./Utils/Theme/lightTheme";
import darkTheme from "./Utils/Theme/darkTheme";
@@ -39,18 +11,9 @@ import { CssBaseline, GlobalStyles } from "@mui/material";
import { getAppSettings } from "./Features/Settings/settingsSlice";
import { logger } from "./Utils/Logger"; // Import the logger
import { networkService } from "./main";
-import { Infrastructure } from "./Pages/Infrastructure";
-import InfrastructureDetails from "./Pages/Infrastructure/Details";
+import { Routes } from "./Routes";
+
function App() {
- const AdminCheckedRegister = withAdminCheck(Register);
- const MonitorsWithAdminProp = withAdminProp(Monitors);
- const MonitorDetailsWithAdminProp = withAdminProp(Details);
- const PageSpeedWithAdminProp = withAdminProp(PageSpeed);
- const PageSpeedDetailsWithAdminProp = withAdminProp(PageSpeedDetails);
- const MaintenanceWithAdminProp = withAdminProp(Maintenance);
- const SettingsWithAdminProp = withAdminProp(Settings);
- const AdvancedSettingsWithAdminProp = withAdminProp(AdvancedSettings);
- const InfrastructureDetailsWithAdminProp = withAdminProp(InfrastructureDetails);
const mode = useSelector((state) => state.ui.mode);
const { authToken } = useSelector((state) => state.auth);
const dispatch = useDispatch();
@@ -82,161 +45,7 @@ function App() {
};
}}
/>
- {/* Extract Routes to Routes */}
-
- }
- >
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
-
- }
- />
-
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
- }
- />
-
- }
- />
-
- }
- />
-
- }
- />
-
-
- }
- />
-
- }
- />
-
- }
- />
-
- }
- />
-
- }
- />
- }
- />
- }
- />
- }
- />
-
+
);
diff --git a/Client/src/Routes/index.jsx b/Client/src/Routes/index.jsx
new file mode 100644
index 000000000..8397729ca
--- /dev/null
+++ b/Client/src/Routes/index.jsx
@@ -0,0 +1,209 @@
+import { Navigate, Route, Routes as LibRoutes } from "react-router";
+import HomeLayout from "../Components/Layouts/HomeLayout";
+import { Infrastructure } from "../Pages/Infrastructure";
+import InfrastructureDetails from "../Pages/Infrastructure/Details";
+import NotFound from "../Pages/NotFound";
+import Login from "../Pages/Auth/Login";
+import Register from "../Pages/Auth/Register/Register";
+import Account from "../Pages/Account";
+import Monitors from "../Pages/Monitors/Home";
+import CreateMonitor from "../Pages/Monitors/CreateMonitor";
+import CreateInfrastructureMonitor from "../Pages/Infrastructure/CreateMonitor";
+import Incidents from "../Pages/Incidents";
+import Status from "../Pages/Status";
+import Integrations from "../Pages/Integrations";
+import Settings from "../Pages/Settings";
+import ForgotPassword from "../Pages/Auth/ForgotPassword";
+import CheckEmail from "../Pages/Auth/CheckEmail";
+import SetNewPassword from "../Pages/Auth/SetNewPassword";
+import NewPasswordConfirmed from "../Pages/Auth/NewPasswordConfirmed";
+import ProtectedRoute from "../Components/ProtectedRoute";
+import Details from "../Pages/Monitors/Details";
+import AdvancedSettings from "../Pages/AdvancedSettings";
+import Maintenance from "../Pages/Maintenance";
+import Configure from "../Pages/Monitors/Configure";
+import PageSpeed from "../Pages/PageSpeed";
+import CreatePageSpeed from "../Pages/PageSpeed/CreatePageSpeed";
+import CreateNewMaintenanceWindow from "../Pages/Maintenance/CreateMaintenance";
+import PageSpeedDetails from "../Pages/PageSpeed/Details";
+import PageSpeedConfigure from "../Pages/PageSpeed/Configure";
+import withAdminCheck from "../Components/HOC/withAdminCheck";
+import withAdminProp from "../Components/HOC/withAdminProp";
+
+const Routes = () => {
+ const AdminCheckedRegister = withAdminCheck(Register);
+ const MonitorsWithAdminProp = withAdminProp(Monitors);
+ const MonitorDetailsWithAdminProp = withAdminProp(Details);
+ const PageSpeedWithAdminProp = withAdminProp(PageSpeed);
+ const PageSpeedDetailsWithAdminProp = withAdminProp(PageSpeedDetails);
+ const MaintenanceWithAdminProp = withAdminProp(Maintenance);
+ const SettingsWithAdminProp = withAdminProp(Settings);
+ const AdvancedSettingsWithAdminProp = withAdminProp(AdvancedSettings);
+ const InfrastructureDetailsWithAdminProp = withAdminProp(InfrastructureDetails);
+ return (
+
+ }
+ >
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+
+
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+
+ }
+ />
+ }
+ />
+ }
+ />
+ }
+ />
+
+ );
+};
+
+export { Routes };
+
+/* import { createBrowserRouter } from "react-router-dom";
+
+const router = createBrowserRouter({
+ {
+ path: "/",
+ }
+});
+
+export { router }; */