diff --git a/.gitignore b/.gitignore index 81e5668b6..ff828c1ec 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ mongo node_modules/ docs/architecture docs/reviews -docs/todo \ No newline at end of file +docs/todo +docs/frontend \ No newline at end of file diff --git a/client/src/Components/design-elements/BaseChart.tsx b/client/src/Components/design-elements/BaseChart.tsx index 569652b20..de87395eb 100644 --- a/client/src/Components/design-elements/BaseChart.tsx +++ b/client/src/Components/design-elements/BaseChart.tsx @@ -2,6 +2,7 @@ import { BaseBox } from "."; import Stack from "@mui/material/Stack"; import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; +import { LAYOUT } from "@/Utils/Theme/constants"; import type { ResponsiveStyleValue } from "@mui/system"; import { useTheme } from "@mui/material/styles"; @@ -26,7 +27,7 @@ export const BaseChart = ({ return ( {icon && ( @@ -220,7 +221,7 @@ export const BaseAuthPage = ({ return ( {title} {subtitle} { lg: "50%", xl: "40%", }} - padding={{ xs: theme.spacing(8), md: theme.spacing(16) }} + padding={{ xs: theme.spacing(LAYOUT.MD), md: theme.spacing(LAYOUT.XXL) }} bgcolor={theme.palette.background.paper} border={1} borderColor={theme.palette.divider} @@ -55,7 +56,7 @@ export const ErrorFallback = ({ {title} @@ -81,7 +82,7 @@ export const EmptyFallback = ({ return ( @@ -89,7 +90,7 @@ export const EmptyFallback = ({ @@ -147,7 +148,7 @@ export const EmptyMonitorFallback = ({ {right} @@ -60,7 +61,7 @@ export const ConfigBox = ({ return ( + + {data.map((row) => { const key = row.id || row._id || Math.random(); keys.push(key); return ( (onRowClick ? onRowClick(row) : null)} - spacing={theme.spacing(4)} + spacing={theme.spacing(LAYOUT.XS)} sx={{ borderStyle: "solid", borderWidth: 1, borderColor: theme.palette.divider, borderRadius: theme.shape.borderRadius, - padding: theme.spacing(4), + padding: theme.spacing(LAYOUT.XS), cursor: onRowClick ? "pointer" : "default", }} key={key} @@ -155,7 +156,7 @@ export function DataTable< { display: "grid", gridTemplateColumns: "1fr 1fr", gridAutoRows: "auto", - rowGap: theme.spacing(1), + rowGap: theme.spacing(SPACING.SM), alignItems: "center", justifyItems: "center", paddingLeft: 0, @@ -556,8 +557,8 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) => alignItems={"center"} justifyContent={"center"} sx={{ - py: theme.spacing(12), - px: theme.spacing(4), + py: theme.spacing(LAYOUT.XL), + px: theme.spacing(LAYOUT.XS), borderWidth: 1, borderStyle: "solid", borderColor: theme.palette.divider, @@ -574,7 +575,7 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) => display: "flex", alignItems: "center", justifyContent: "center", - mb: theme.spacing(2), + mb: theme.spacing(SPACING.LG), }} > }); const menuItemSx = { - gap: theme.spacing(2), + gap: theme.spacing(LAYOUT.MD), borderRadius: theme.shape.borderRadius, - pl: theme.spacing(4), + pl: theme.spacing(LAYOUT.XS), "& svg": { stroke: theme.palette.text.secondary }, }; @@ -74,9 +75,9 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) => @@ -132,10 +133,15 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) => disableScrollLock anchorOrigin={{ vertical: "top", horizontal: "right" }} slotProps={{ - paper: { sx: { mt: theme.spacing(-4), ml: collapsed ? theme.spacing(2) : 0 } }, + paper: { + sx: { + mt: theme.spacing(-LAYOUT.XS), + ml: collapsed ? theme.spacing(SPACING.LG) : 0, + }, + }, }} MenuListProps={{ sx: { p: 2, "& li": { m: 0 } } }} - sx={{ ml: theme.spacing(4) }} + sx={{ ml: theme.spacing(LAYOUT.XS) }} > {collapsed && ( {t("components.sidebar.starPrompt.title")} @@ -78,7 +76,7 @@ export const StarPrompt = ({ {t("components.sidebar.starPrompt.description")} @@ -96,7 +94,7 @@ export const StarPrompt = ({ "&:hover": { opacity: 0.8, }, - pl: theme.spacing(4), + pl: theme.spacing(LAYOUT.XS), filter: mode === "dark" ? "invert(1)" : "none", }} /> diff --git a/client/src/Components/sidebar/index.tsx b/client/src/Components/sidebar/index.tsx index dcf02e45f..f4c6527eb 100644 --- a/client/src/Components/sidebar/index.tsx +++ b/client/src/Components/sidebar/index.tsx @@ -3,6 +3,7 @@ import Backdrop from "@mui/material/Backdrop"; import Stack from "@mui/material/Stack"; import List from "@mui/material/List"; import Divider from "@mui/material/Divider"; +import { LAYOUT } from "@/Utils/Theme/constants"; import { useSidebar } from "@/Hooks/useSidebar.js"; import { Logo } from "@/Components/sidebar/Logo"; import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/sidebar/Menu"; @@ -65,9 +66,9 @@ export const Sidebar = () => { left={0} minHeight={"100vh"} maxHeight={"100vh"} - paddingTop={theme.spacing(6)} - paddingBottom={theme.spacing(6)} - gap={theme.spacing(6)} + paddingTop={theme.spacing(LAYOUT.SM)} + paddingBottom={theme.spacing(LAYOUT.SM)} + gap={theme.spacing(LAYOUT.SM)} borderRight={`1px solid ${theme.palette.divider}`} width={width} sx={{ @@ -81,13 +82,13 @@ export const Sidebar = () => { component="nav" disablePadding sx={{ - px: theme.spacing(6), + px: theme.spacing(LAYOUT.SM), flex: 1, }} > {menu.map((item) => { const selected = location.pathname.startsWith(`/${item.path}`); @@ -105,7 +106,7 @@ export const Sidebar = () => { {bottomMenu.map((item) => { const selected = location.pathname.startsWith(`/${item.path}`); diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index 4d6c7dfeb..34e141795 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -29,6 +29,7 @@ import { SliderWithLabel, Dialog, } from "@/Components/inputs"; +import { SPACING, LAYOUT } from "@/Utils/Theme/constants"; import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi"; import { useMonitorForm } from "@/Hooks/useMonitorForm"; import type { Monitor, MonitorType, GamesMap } from "@/Types/Monitor"; @@ -281,7 +282,7 @@ const CreateMonitorPage = () => { { title={t("pages.createMonitor.form.general.title")} subtitle={t(`pages.createMonitor.form.general.description.${watchedType}`)} rightContent={ - + {/* URL/Host/Container field - not shown for hardware */} {generalSettingsConfig.showUrl && ( { title={t("pages.createMonitor.form.thresholds.title")} subtitle={t("pages.createMonitor.form.thresholds.description")} rightContent={ - + { title={t("pages.createMonitor.form.incidents.title")} subtitle={t("pages.createMonitor.form.incidents.description")} rightContent={ - + { (field.value ?? []).includes(n.id) ); return ( - + { { title={t("pages.createMonitor.form.advanced.title")} subtitle={t("pages.createMonitor.form.advanced.description")} rightContent={ - + { { )} /> {watchedUseAdvancedMatching && ( - + { title={t("pages.createMonitor.form.geoChecks.title")} subtitle={t("pages.createMonitor.form.geoChecks.description")} rightContent={ - + { { )} /> {watchGeoCheckEnabled && ( - + { (field.value ?? []).includes(loc.id) ); return ( - + { } return ( {t("pages.incidents.dialog.details.title")} - - + + {t("pages.incidents.dialog.details.overview")} @@ -44,7 +45,7 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => { {t("pages.incidents.dialog.details.status")} @@ -75,15 +76,15 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => { - - + + {t("pages.incidents.dialog.details.analysis")} {t("pages.incidents.dialog.details.timeline")} @@ -127,15 +128,15 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => { {!incident.status && ( - - + + {t("pages.incidents.dialog.details.resolutionDetails")} diff --git a/client/src/Pages/Maintenance/create/index.tsx b/client/src/Pages/Maintenance/create/index.tsx index e5293c897..d130ee7c7 100644 --- a/client/src/Pages/Maintenance/create/index.tsx +++ b/client/src/Pages/Maintenance/create/index.tsx @@ -3,6 +3,7 @@ import MenuItem from "@mui/material/MenuItem"; import { logger } from "@/Utils/logger"; import Typography from "@mui/material/Typography"; import IconButton from "@mui/material/IconButton"; +import { SPACING, LAYOUT } from "@/Utils/Theme/constants"; import { BasePage, ConfigBox } from "@/Components/design-elements"; import { TextField, @@ -121,7 +122,7 @@ const CreateMaintenanceWindowPage = () => { title={t("pages.maintenanceWindow.form.general.title")} subtitle={t("pages.maintenanceWindow.form.general.description")} rightContent={ - + { title={t("pages.maintenanceWindow.form.startDate.title")} subtitle={t("pages.maintenanceWindow.form.startDate.description")} rightContent={ - + { title={t("pages.maintenanceWindow.form.startTime.title")} subtitle={t("pages.maintenanceWindow.form.startTime.description")} rightContent={ - + { { .filter((m): m is Monitor => m !== undefined); return ( - + { key={monitor.id} direction="row" alignItems="center" - spacing={theme.spacing(4)} - padding={theme.spacing(4)} - marginTop={theme.spacing(2)} + padding={theme.spacing(LAYOUT.XS)} + marginTop={theme.spacing(SPACING.LG)} borderRadius={1} sx={{ border: `1px solid ${theme.palette.divider}`, @@ -351,7 +351,7 @@ const CreateMaintenanceWindowPage = () => {