Files
Checkmate/client/src/Routes/index.jsx
T

299 lines
6.9 KiB
React
Raw Normal View History

2026-01-23 19:58:37 +00:00
// Temp v2 theme
import { ThemeProvider } from "@mui/material";
import { lightTheme, darkTheme } from "@/Utils/Theme/v2Theme";
2025-09-25 16:06:52 -07:00
import { useSelector } from "react-redux";
import { Navigate, Route, Routes as LibRoutes } from "react-router";
2025-09-27 14:54:55 -07:00
import HomeLayout from "@/Components/v1/Layouts/HomeLayout";
2026-01-12 23:57:39 +00:00
import NotFound from "../Pages/NotFound/index.jsx";
2025-01-28 11:04:11 -08:00
// Auth
2026-01-12 23:57:39 +00:00
import AuthLogin from "../Pages/Auth/Login/index.jsx";
import AuthRegister from "../Pages/Auth/Register/index.jsx";
import AuthForgotPassword from "../Pages/Auth/ForgotPassword.jsx";
import AuthCheckEmail from "../Pages/Auth/CheckEmail.jsx";
import AuthSetNewPassword from "../Pages/Auth/SetNewPassword.jsx";
import AuthNewPasswordConfirmed from "../Pages/Auth/NewPasswordConfirmed.jsx";
2025-01-28 11:04:11 -08:00
// Uptime
2026-01-23 19:58:37 +00:00
import Uptime from "../Pages/Uptime/Monitors";
2026-01-25 02:09:33 +00:00
import UptimeDetails from "../Pages/Uptime/Details";
2026-01-12 23:57:39 +00:00
import UptimeCreate from "../Pages/Uptime/Create/index.jsx";
2025-01-28 11:04:11 -08:00
// PageSpeed
2026-01-26 18:24:58 +00:00
import PageSpeed from "../Pages/PageSpeed/Monitors/index";
2026-01-26 21:14:04 +00:00
import PageSpeedDetails from "../Pages/PageSpeed/Details/";
2026-01-12 23:57:39 +00:00
import PageSpeedCreate from "../Pages/PageSpeed/Create/index.jsx";
2025-01-28 11:04:11 -08:00
// Infrastructure
2026-01-12 23:57:39 +00:00
import Infrastructure from "../Pages/Infrastructure/Monitors/index.jsx";
import InfrastructureCreate from "../Pages/Infrastructure/Create/index.jsx";
import InfrastructureDetails from "../Pages/Infrastructure/Details/index.jsx";
2025-01-27 14:55:55 -08:00
2025-05-04 22:54:55 -04:00
// Server Status
2026-01-12 23:57:39 +00:00
import ServerUnreachable from "../Pages/ServerUnreachable.jsx";
2025-05-04 22:54:55 -04:00
2026-01-20 19:12:05 +00:00
// Checks
import Checks from "../Pages/Checks/index.jsx";
2025-02-05 14:58:34 -08:00
// Incidents
2026-01-20 19:12:05 +00:00
import Incidents from "../Pages/Incidents/index.jsx";
2025-01-29 15:06:41 -08:00
2025-02-05 14:58:34 -08:00
// Status pages
2026-01-12 23:57:39 +00:00
import CreateStatus from "../Pages/StatusPage/Create/index.jsx";
import StatusPages from "../Pages/StatusPage/StatusPages/index.jsx";
import Status from "../Pages/StatusPage/Status/index.jsx";
2025-02-02 21:26:48 -08:00
2026-01-12 23:57:39 +00:00
import Notifications from "../Pages/Notifications/index.jsx";
import CreateNotifications from "../Pages/Notifications/create/index.jsx";
2025-01-28 11:04:11 -08:00
// Settings
2026-01-12 23:57:39 +00:00
import Account from "../Pages/Account/index.jsx";
import EditUser from "../Pages/Account/EditUser/index.jsx";
import Settings from "../Pages/Settings";
2025-01-28 11:04:11 -08:00
2026-01-12 23:57:39 +00:00
import Maintenance from "../Pages/Maintenance/index.jsx";
2025-01-28 11:04:11 -08:00
2025-09-27 14:54:55 -07:00
import ProtectedRoute from "../Components/v1/ProtectedRoute";
import RoleProtectedRoute from "../Components/v1/RoleProtectedRoute";
2026-01-12 23:57:39 +00:00
import CreateNewMaintenanceWindow from "../Pages/Maintenance/CreateMaintenance/index.jsx";
2025-09-27 14:54:55 -07:00
import withAdminCheck from "@/Components/v1/HOC/withAdminCheck";
2026-01-12 23:57:39 +00:00
import BulkImport from "../Pages/Uptime/BulkImport/index.jsx";
import Logs from "../Pages/Logs/index.jsx";
const Routes = () => {
2025-09-25 16:06:52 -07:00
const mode = useSelector((state) => state.ui.mode);
2025-01-28 11:04:11 -08:00
const AdminCheckedRegister = withAdminCheck(AuthRegister);
2026-01-26 18:24:58 +00:00
const v2theme = mode === "light" ? lightTheme : darkTheme;
return (
<LibRoutes>
<Route
path="/"
element={
<ProtectedRoute>
<HomeLayout />
</ProtectedRoute>
}
>
<Route
path="/"
2024-12-12 09:20:24 -05:00
element={<Navigate to="/uptime" />}
/>
<Route
2024-12-12 09:20:24 -05:00
path="/uptime"
2026-01-23 19:58:37 +00:00
element={
<>
2026-01-26 18:24:58 +00:00
<ThemeProvider theme={v2theme}>
2026-01-23 19:58:37 +00:00
<Uptime />
</ThemeProvider>
</>
}
/>
2025-01-07 14:31:25 -08:00
2025-04-27 03:05:14 +05:30
<Route
path="/uptime/bulk-import"
element={<BulkImport />}
/>
<Route
path="/uptime/create"
2025-01-28 11:04:11 -08:00
element={<UptimeCreate />}
/>
<Route
path="/uptime/create/:monitorId"
element={<UptimeCreate isClone={true} />}
/>
<Route
2024-12-12 09:20:24 -05:00
path="/uptime/:monitorId/"
2026-01-25 02:09:33 +00:00
element={
<>
2026-01-26 18:24:58 +00:00
<ThemeProvider theme={v2theme}>
2026-01-25 02:09:33 +00:00
<UptimeDetails />
</ThemeProvider>
</>
}
/>
<Route
2024-12-12 09:20:24 -05:00
path="/uptime/configure/:monitorId/"
element={<UptimeCreate />}
/>
2025-02-07 15:18:41 -08:00
<Route
path="pagespeed"
2026-01-26 18:24:58 +00:00
element={
<>
<ThemeProvider theme={v2theme}>
<PageSpeed />
</ThemeProvider>
</>
}
/>
<Route
path="pagespeed/create"
element={<PageSpeedCreate />}
/>
<Route
path="pagespeed/:monitorId"
2026-01-26 22:28:02 +00:00
element={
<>
<ThemeProvider theme={v2theme}>
<PageSpeedDetails />
</ThemeProvider>
</>
}
/>
<Route
path="pagespeed/configure/:monitorId"
element={<PageSpeedCreate />}
/>
<Route
path="infrastructure"
element={<Infrastructure />}
/>
<Route
path="infrastructure/create"
2025-01-28 11:04:11 -08:00
element={<InfrastructureCreate />}
/>
2025-05-02 15:53:33 -07:00
<Route
path="/infrastructure/configure/:monitorId"
element={<InfrastructureCreate />}
2025-03-14 21:40:12 -04:00
/>
<Route
path="infrastructure/:monitorId"
element={<InfrastructureDetails />}
/>
2025-12-17 18:51:34 -05:00
<Route
path="checks/:monitorId?"
element={<Checks />}
/>
<Route
path="incidents/:monitorId?"
2026-01-20 19:12:05 +00:00
element={<Incidents />}
/>
<Route
path="status"
2025-02-10 13:45:23 -08:00
element={<StatusPages />}
/>
<Route
path="status/uptime/:url"
2025-02-04 14:07:24 -08:00
element={<Status />}
/>
2024-12-20 10:59:12 -05:00
2025-02-10 13:45:23 -08:00
<Route
path="status/uptime/create"
2025-02-02 21:26:48 -08:00
element={<CreateStatus />}
/>
2025-02-10 13:45:23 -08:00
<Route
path="status/uptime/configure/:url"
2025-02-05 10:56:21 -08:00
element={<CreateStatus />}
/>
2025-02-03 15:11:45 -08:00
<Route
2025-06-09 12:56:24 +08:00
path="notifications"
element={<Notifications />}
/>
<Route
path="notifications/create"
element={<CreateNotifications />}
/>
2025-06-10 11:13:19 +08:00
<Route
path="notifications/:notificationId"
element={<CreateNotifications />}
/>
<Route
path="maintenance"
element={<Maintenance />}
/>
<Route
path="/maintenance/create/:maintenanceWindowId?"
element={<CreateNewMaintenanceWindow />}
/>
<Route
path="settings"
element={<Settings />}
/>
<Route
path="account/profile"
element={<Account open={"profile"} />}
/>
<Route
path="account/password"
element={<Account open={"password"} />}
/>
<Route
path="account/team"
element={<Account open={"team"} />}
/>
2025-07-22 12:27:06 -07:00
<Route
path="account/team/:userId"
element={
<RoleProtectedRoute roles={["superadmin"]}>
<EditUser />
</RoleProtectedRoute>
}
/>
2025-06-23 11:07:12 +08:00
2025-06-20 14:28:33 +08:00
<Route
2025-06-23 11:07:12 +08:00
path="logs"
2025-06-25 12:38:57 +08:00
element={
<RoleProtectedRoute roles={["admin", "superadmin"]}>
<Logs />
</RoleProtectedRoute>
}
2025-06-20 14:28:33 +08:00
/>
</Route>
<Route
path="/login"
2025-01-28 11:04:11 -08:00
element={<AuthLogin />}
/>
<Route
path="/register"
element={<AdminCheckedRegister />}
/>
<Route
exact
path="/register/:token"
2025-08-28 12:58:38 -04:00
element={<AuthRegister superAdminExists={true} />}
/>
<Route
path="/forgot-password"
2025-01-28 11:04:11 -08:00
element={<AuthForgotPassword />}
/>
<Route
path="/check-email"
2025-01-28 11:04:11 -08:00
element={<AuthCheckEmail />}
/>
<Route
path="/set-new-password/:token"
2025-01-28 11:04:11 -08:00
element={<AuthSetNewPassword />}
/>
<Route
path="/new-password-confirmed"
2025-01-28 11:04:11 -08:00
element={<AuthNewPasswordConfirmed />}
/>
2025-02-04 13:06:42 -08:00
<Route
2025-02-10 13:45:23 -08:00
path="/status/uptime/public/:url"
2025-02-04 14:07:24 -08:00
element={<Status />}
2025-02-04 13:06:42 -08:00
/>
2025-05-04 22:54:55 -04:00
<Route
path="/server-unreachable"
element={<ServerUnreachable />}
/>
<Route
path="*"
element={<NotFound />}
/>
</LibRoutes>
);
};
export { Routes };