Merge pull request #3346 from bluewave-labs/fix/hardcoded-dimensions

Fix/hardcoded dimensions
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-03-01 07:19:44 -08:00
commit 0bff26fe47
17 files changed
+148 -114

No files matched your search

+2 -1
View File
@@ -6,4 +6,5 @@ mongo
node_modules/ node_modules/
docs/architecture docs/architecture
docs/reviews docs/reviews
docs/todo docs/todo
docs/frontend
@@ -2,6 +2,7 @@ import { BaseBox } from ".";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { LAYOUT } from "@/Utils/Theme/constants";
import type { ResponsiveStyleValue } from "@mui/system"; import type { ResponsiveStyleValue } from "@mui/system";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
@@ -26,7 +27,7 @@ export const BaseChart = ({
return ( return (
<BaseBox <BaseBox
sx={{ sx={{
padding: padding ?? theme.spacing(8), padding: padding ?? theme.spacing(LAYOUT.MD),
display: "flex", display: "flex",
flex: 1, flex: 1,
width: width, width: width,
@@ -34,13 +35,13 @@ export const BaseChart = ({
}} }}
> >
<Stack <Stack
gap={theme.spacing(8)} gap={theme.spacing(LAYOUT.MD)}
flex={1} flex={1}
> >
<Stack <Stack
direction="row" direction="row"
alignItems={"center"} alignItems={"center"}
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.XS)}
> >
{icon && ( {icon && (
<BaseBox <BaseBox
@@ -3,6 +3,7 @@ import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import Alert from "@mui/material/Alert"; import Alert from "@mui/material/Alert";
import Link from "@mui/material/Link"; import Link from "@mui/material/Link";
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
import { import {
ErrorFallback, ErrorFallback,
EmptyFallback, EmptyFallback,
@@ -91,7 +92,7 @@ export const BasePage = ({
return ( return (
<Stack <Stack
spacing={theme.spacing(10)} spacing={theme.spacing(LAYOUT.LG)}
{...props} {...props}
> >
<Breadcrumb breadcrumbOverride={breadcrumbOverride} /> <Breadcrumb breadcrumbOverride={breadcrumbOverride} />
@@ -220,7 +221,7 @@ export const BaseAuthPage = ({
return ( return (
<BasePage <BasePage
breadcrumbOverride={[]} breadcrumbOverride={[]}
gap={theme.spacing(8)} gap={theme.spacing(LAYOUT.MD)}
alignItems={"center"} alignItems={"center"}
justifyContent={"center"} justifyContent={"center"}
minHeight="100vh" minHeight="100vh"
@@ -229,7 +230,7 @@ export const BaseAuthPage = ({
> >
<HeaderAuthControls <HeaderAuthControls
hideLogo hideLogo
py={theme.spacing(4)} py={theme.spacing(LAYOUT.XS)}
position={"absolute"} position={"absolute"}
top={0} top={0}
left={0} left={0}
@@ -243,14 +244,14 @@ export const BaseAuthPage = ({
<Stack alignItems={"center"}> <Stack alignItems={"center"}>
<Typography <Typography
variant="h1" variant="h1"
mb={theme.spacing(2)} mb={theme.spacing(SPACING.LG)}
> >
{title} {title}
</Typography> </Typography>
<Typography variant="h2">{subtitle}</Typography> <Typography variant="h2">{subtitle}</Typography>
</Stack> </Stack>
<Stack <Stack
gap={theme.spacing(8)} gap={theme.spacing(LAYOUT.MD)}
width={{ width={{
xs: "80%", xs: "80%",
md: "25%", md: "25%",
@@ -2,6 +2,7 @@ import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { Check } from "lucide-react"; import { Check } from "lucide-react";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { LAYOUT } from "@/Utils/Theme/constants";
export const BulletPointCheck = ({ export const BulletPointCheck = ({
text, text,
@@ -21,7 +22,7 @@ export const BulletPointCheck = ({
return ( return (
<Stack <Stack
direction="row" direction="row"
gap={theme.spacing(6)} gap={theme.spacing(LAYOUT.SM)}
alignItems="center" alignItems="center"
> >
<Check <Check
@@ -2,6 +2,7 @@ import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { BulletPointCheck, SkeletonCard } from "@/Components/design-elements"; import { BulletPointCheck, SkeletonCard } from "@/Components/design-elements";
import { Button } from "@/Components/inputs"; import { Button } from "@/Components/inputs";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
@@ -27,7 +28,7 @@ export const BaseFallback = ({ children, ...props }: BaseFallbackProps) => {
lg: "50%", lg: "50%",
xl: "40%", 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} bgcolor={theme.palette.background.paper}
border={1} border={1}
borderColor={theme.palette.divider} borderColor={theme.palette.divider}
@@ -55,7 +56,7 @@ export const ErrorFallback = ({
<BaseFallback> <BaseFallback>
<Typography <Typography
variant="h1" variant="h1"
marginY={theme.spacing(4)} marginY={theme.spacing(LAYOUT.XS)}
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
> >
{title} {title}
@@ -81,7 +82,7 @@ export const EmptyFallback = ({
return ( return (
<BaseFallback> <BaseFallback>
<Stack <Stack
gap={theme.spacing(10)} gap={theme.spacing(LAYOUT.MD)}
zIndex={1} zIndex={1}
alignItems="center" alignItems="center"
> >
@@ -89,7 +90,7 @@ export const EmptyFallback = ({
<Stack <Stack
sx={{ sx={{
flexWrap: "wrap", flexWrap: "wrap",
gap: theme.spacing(2), gap: theme.spacing(SPACING.MD),
maxWidth: "1100px", maxWidth: "1100px",
width: "100%", width: "100%",
}} }}
@@ -134,7 +135,7 @@ export const EmptyMonitorFallback = ({
return ( return (
<BaseFallback> <BaseFallback>
<Stack <Stack
gap={theme.spacing(10)} gap={theme.spacing(LAYOUT.MD)}
zIndex={1} zIndex={1}
alignItems="center" alignItems="center"
> >
@@ -147,7 +148,7 @@ export const EmptyMonitorFallback = ({
<Stack <Stack
sx={{ sx={{
flexWrap: "wrap", flexWrap: "wrap",
gap: theme.spacing(2), gap: theme.spacing(SPACING.MD),
maxWidth: "1100px", maxWidth: "1100px",
width: "100%", width: "100%",
}} }}
@@ -3,6 +3,7 @@ import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
import { LAYOUT } from "@/Utils/Theme/constants";
export const SplitBox = ({ export const SplitBox = ({
left, left,
right, right,
@@ -18,10 +19,10 @@ export const SplitBox = ({
bgcolor={theme.palette.background.paper} bgcolor={theme.palette.background.paper}
border={1} border={1}
borderColor={theme.palette.divider} borderColor={theme.palette.divider}
borderRadius={theme.spacing(2)} borderRadius={theme.shape.borderRadius}
> >
<Box <Box
padding={theme.spacing(15)} padding={theme.spacing(LAYOUT.XXL)}
borderRight={isSmall ? 0 : 1} borderRight={isSmall ? 0 : 1}
borderBottom={isSmall ? 1 : 0} borderBottom={isSmall ? 1 : 0}
borderColor={theme.palette.divider} borderColor={theme.palette.divider}
@@ -37,7 +38,7 @@ export const SplitBox = ({
</Box> </Box>
<Box <Box
flex={1} flex={1}
padding={theme.spacing(15)} padding={theme.spacing(LAYOUT.XXL)}
> >
{right} {right}
</Box> </Box>
@@ -60,7 +61,7 @@ export const ConfigBox = ({
return ( return (
<SplitBox <SplitBox
left={ left={
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.XS)}>
<Typography <Typography
textTransform={"capitalize"} textTransform={"capitalize"}
component="h2" component="h2"
+11 -10
View File
@@ -29,6 +29,7 @@ import type { TablePaginationOwnProps } from "@mui/material/TablePagination";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useState, Fragment, useEffect } from "react"; import { useState, Fragment, useEffect } from "react";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import type { SxProps, Theme } from "@mui/material/styles"; import type { SxProps, Theme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery"; import useMediaQuery from "@mui/material/useMediaQuery";
@@ -90,20 +91,20 @@ export function DataTable<
// Return stack of cards for small screens // Return stack of cards for small screens
if (isSmall && cardsOnSmallScreens) { if (isSmall && cardsOnSmallScreens) {
return ( return (
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.XS)}>
{data.map((row) => { {data.map((row) => {
const key = row.id || row._id || Math.random(); const key = row.id || row._id || Math.random();
keys.push(key); keys.push(key);
return ( return (
<Stack <Stack
onClick={() => (onRowClick ? onRowClick(row) : null)} onClick={() => (onRowClick ? onRowClick(row) : null)}
spacing={theme.spacing(4)} spacing={theme.spacing(LAYOUT.XS)}
sx={{ sx={{
borderStyle: "solid", borderStyle: "solid",
borderWidth: 1, borderWidth: 1,
borderColor: theme.palette.divider, borderColor: theme.palette.divider,
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
padding: theme.spacing(4), padding: theme.spacing(LAYOUT.XS),
cursor: onRowClick ? "pointer" : "default", cursor: onRowClick ? "pointer" : "default",
}} }}
key={key} key={key}
@@ -155,7 +156,7 @@ export function DataTable<
<Table <Table
sx={{ sx={{
"&.MuiTable-root :is(.MuiTableHead-root, .MuiTableBody-root) :is(th, td)": { "&.MuiTable-root :is(.MuiTableHead-root, .MuiTableBody-root) :is(th, td)": {
paddingLeft: theme.spacing(8), paddingLeft: theme.spacing(LAYOUT.MD),
}, },
"& .MuiTableCell-root": { "& .MuiTableCell-root": {
borderBottom: `1px solid ${theme.palette.divider}`, borderBottom: `1px solid ${theme.palette.divider}`,
@@ -168,13 +169,13 @@ export function DataTable<
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
fontWeight: 500, fontWeight: 500,
textTransform: "uppercase", textTransform: "uppercase",
padding: `${theme.spacing(2)} ${theme.spacing(8)}`, padding: `${theme.spacing(SPACING.LG)} ${theme.spacing(LAYOUT.MD)}`,
fontSize: theme.typography.fontSize, fontSize: theme.typography.fontSize,
}, },
"& :is(td)": { "& :is(td)": {
backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
padding: `${theme.spacing(7)} ${theme.spacing(8)}`, padding: `${theme.spacing(LAYOUT.MD)} ${theme.spacing(LAYOUT.MD)}`,
fontSize: theme.typography.fontSize, fontSize: theme.typography.fontSize,
overflowX: "hidden", overflowX: "hidden",
}, },
@@ -514,7 +515,7 @@ export const Pagination = ({ ...props }: PaginationProps) => {
display: "grid", display: "grid",
gridTemplateColumns: "1fr 1fr", gridTemplateColumns: "1fr 1fr",
gridAutoRows: "auto", gridAutoRows: "auto",
rowGap: theme.spacing(1), rowGap: theme.spacing(SPACING.SM),
alignItems: "center", alignItems: "center",
justifyItems: "center", justifyItems: "center",
paddingLeft: 0, paddingLeft: 0,
@@ -556,8 +557,8 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) =>
alignItems={"center"} alignItems={"center"}
justifyContent={"center"} justifyContent={"center"}
sx={{ sx={{
py: theme.spacing(12), py: theme.spacing(LAYOUT.XL),
px: theme.spacing(4), px: theme.spacing(LAYOUT.XS),
borderWidth: 1, borderWidth: 1,
borderStyle: "solid", borderStyle: "solid",
borderColor: theme.palette.divider, borderColor: theme.palette.divider,
@@ -574,7 +575,7 @@ const EmptyView = ({ text, positive }: { text?: string; positive?: boolean }) =>
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
mb: theme.spacing(2), mb: theme.spacing(SPACING.LG),
}} }}
> >
<Icon <Icon
@@ -2,6 +2,7 @@ import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { formatDateWithTz } from "@/Utils/TimeUtils"; import { formatDateWithTz } from "@/Utils/TimeUtils";
import type { ConfigItem } from "@/Components/monitors"; import type { ConfigItem } from "@/Components/monitors";
import type { TooltipProps } from "recharts"; import type { TooltipProps } from "recharts";
@@ -30,8 +31,8 @@ export const HistogramPageSpeedScoresTooltip = ({
border: 1, border: 1,
borderColor: theme.palette.divider, borderColor: theme.palette.divider,
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
py: theme.spacing(2), py: theme.spacing(SPACING.LG),
px: theme.spacing(4), px: theme.spacing(LAYOUT.XS),
}} }}
> >
<Typography <Typography
@@ -54,12 +55,12 @@ export const HistogramPageSpeedScoresTooltip = ({
key={`${key}-tooltip`} key={`${key}-tooltip`}
direction="row" direction="row"
alignItems="center" alignItems="center"
gap={theme.spacing(3)} gap={theme.spacing(SPACING.XXL)}
mt={theme.spacing(1)} mt={theme.spacing(SPACING.SM)}
> >
<Box <Box
width={theme.spacing(4)} width={theme.spacing(LAYOUT.XS)}
height={theme.spacing(4)} height={theme.spacing(LAYOUT.XS)}
sx={{ borderRadius: "50%", backgroundColor: dotColor }} sx={{ borderRadius: "50%", backgroundColor: dotColor }}
/> />
<Typography <Typography
+14 -8
View File
@@ -5,6 +5,7 @@ import IconButton from "@mui/material/IconButton";
import Menu from "@mui/material/Menu"; import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
import { useTheme } from "@mui/material"; import { useTheme } from "@mui/material";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useState } from "react"; import { useState } from "react";
@@ -64,9 +65,9 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) =>
}); });
const menuItemSx = { const menuItemSx = {
gap: theme.spacing(2), gap: theme.spacing(LAYOUT.MD),
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
pl: theme.spacing(4), pl: theme.spacing(LAYOUT.XS),
"& svg": { stroke: theme.palette.text.secondary }, "& svg": { stroke: theme.palette.text.secondary },
}; };
@@ -74,9 +75,9 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) =>
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
py={theme.spacing(4)} py={theme.spacing(LAYOUT.XS)}
px={theme.spacing(8)} px={theme.spacing(LAYOUT.MD)}
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.MD)}
> >
<Avatar <Avatar
small small
@@ -88,7 +89,7 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) =>
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
gap={theme.spacing(2)} gap={theme.spacing(SPACING.MD)}
minWidth={0} minWidth={0}
flex={1} flex={1}
> >
@@ -132,10 +133,15 @@ export const AuthFooter = ({ collapsed, accountMenuItems }: AuthFooterProps) =>
disableScrollLock disableScrollLock
anchorOrigin={{ vertical: "top", horizontal: "right" }} anchorOrigin={{ vertical: "top", horizontal: "right" }}
slotProps={{ 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 } } }} MenuListProps={{ sx: { p: 2, "& li": { m: 0 } } }}
sx={{ ml: theme.spacing(4) }} sx={{ ml: theme.spacing(LAYOUT.XS) }}
> >
{collapsed && ( {collapsed && (
<Box <Box
+10 -12
View File
@@ -1,6 +1,7 @@
import { Typography, IconButton, Stack, Box } from "@mui/material"; import { Typography, IconButton, Stack, Box } from "@mui/material";
import { Icon } from "@/Components/design-elements"; import { Icon } from "@/Components/design-elements";
import { X } from "lucide-react"; import { X } from "lucide-react";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { useTheme } from "@mui/material"; import { useTheme } from "@mui/material";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
@@ -34,25 +35,22 @@ export const StarPrompt = ({
return ( return (
<Stack <Stack
direction="column" direction="column"
sx={{ gap={theme.spacing(LAYOUT.MD)}
width: "100%", padding={theme.spacing(LAYOUT.SM)}
padding: `${theme.spacing(6)} ${theme.spacing(6)}`, width={"100%"}
borderTop: `1px solid ${theme.palette.divider}`, borderTop={`1px solid ${theme.palette.divider}`}
borderBottom: `1px solid ${theme.palette.divider}`, borderBottom={`1px solid ${theme.palette.divider}`}
borderRadius: 0,
gap: theme.spacing(1.5),
}}
> >
<Stack <Stack
direction="row" direction="row"
justifyContent="space-between" justifyContent="space-between"
alignItems="center" alignItems="center"
width="100%" width="100%"
pl={theme.spacing(4)} pl={theme.spacing(LAYOUT.XS)}
> >
<Typography <Typography
variant="subtitle2" variant="subtitle2"
mt={theme.spacing(3)} mt={theme.spacing(SPACING.XXL)}
> >
{t("components.sidebar.starPrompt.title")} {t("components.sidebar.starPrompt.title")}
</Typography> </Typography>
@@ -78,7 +76,7 @@ export const StarPrompt = ({
<Typography <Typography
sx={{ sx={{
mb: 1, mb: 1,
px: theme.spacing(4), px: theme.spacing(LAYOUT.XS),
}} }}
> >
{t("components.sidebar.starPrompt.description")} {t("components.sidebar.starPrompt.description")}
@@ -96,7 +94,7 @@ export const StarPrompt = ({
"&:hover": { "&:hover": {
opacity: 0.8, opacity: 0.8,
}, },
pl: theme.spacing(4), pl: theme.spacing(LAYOUT.XS),
filter: mode === "dark" ? "invert(1)" : "none", filter: mode === "dark" ? "invert(1)" : "none",
}} }}
/> />
+8 -7
View File
@@ -3,6 +3,7 @@ import Backdrop from "@mui/material/Backdrop";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import List from "@mui/material/List"; import List from "@mui/material/List";
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import { LAYOUT } from "@/Utils/Theme/constants";
import { useSidebar } from "@/Hooks/useSidebar.js"; import { useSidebar } from "@/Hooks/useSidebar.js";
import { Logo } from "@/Components/sidebar/Logo"; import { Logo } from "@/Components/sidebar/Logo";
import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/sidebar/Menu"; import { getMenu, getBottomMenu, getAccountMenu } from "@/Components/sidebar/Menu";
@@ -65,9 +66,9 @@ export const Sidebar = () => {
left={0} left={0}
minHeight={"100vh"} minHeight={"100vh"}
maxHeight={"100vh"} maxHeight={"100vh"}
paddingTop={theme.spacing(6)} paddingTop={theme.spacing(LAYOUT.SM)}
paddingBottom={theme.spacing(6)} paddingBottom={theme.spacing(LAYOUT.SM)}
gap={theme.spacing(6)} gap={theme.spacing(LAYOUT.SM)}
borderRight={`1px solid ${theme.palette.divider}`} borderRight={`1px solid ${theme.palette.divider}`}
width={width} width={width}
sx={{ sx={{
@@ -81,13 +82,13 @@ export const Sidebar = () => {
component="nav" component="nav"
disablePadding disablePadding
sx={{ sx={{
px: theme.spacing(6), px: theme.spacing(LAYOUT.SM),
flex: 1, flex: 1,
}} }}
> >
<Logo <Logo
pt={theme.spacing(8)} pt={theme.spacing(LAYOUT.MD)}
pb={theme.spacing(10)} pb={theme.spacing(LAYOUT.MD)}
/> />
{menu.map((item) => { {menu.map((item) => {
const selected = location.pathname.startsWith(`/${item.path}`); const selected = location.pathname.startsWith(`/${item.path}`);
@@ -105,7 +106,7 @@ export const Sidebar = () => {
<List <List
component="nav" component="nav"
disablePadding disablePadding
sx={{ px: theme.spacing(6) }} sx={{ px: theme.spacing(LAYOUT.SM) }}
> >
{bottomMenu.map((item) => { {bottomMenu.map((item) => {
const selected = location.pathname.startsWith(`/${item.path}`); const selected = location.pathname.startsWith(`/${item.path}`);
+14 -13
View File
@@ -29,6 +29,7 @@ import {
SliderWithLabel, SliderWithLabel,
Dialog, Dialog,
} from "@/Components/inputs"; } from "@/Components/inputs";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi"; import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi";
import { useMonitorForm } from "@/Hooks/useMonitorForm"; import { useMonitorForm } from "@/Hooks/useMonitorForm";
import type { Monitor, MonitorType, GamesMap } from "@/Types/Monitor"; import type { Monitor, MonitorType, GamesMap } from "@/Types/Monitor";
@@ -281,7 +282,7 @@ const CreateMonitorPage = () => {
<FormControl error={!!fieldState.error}> <FormControl error={!!fieldState.error}>
<RadioGroup <RadioGroup
{...field} {...field}
sx={{ gap: theme.spacing(6) }} sx={{ gap: theme.spacing(LAYOUT.MD) }}
> >
<RadioWithDescription <RadioWithDescription
value="http" value="http"
@@ -337,7 +338,7 @@ const CreateMonitorPage = () => {
title={t("pages.createMonitor.form.general.title")} title={t("pages.createMonitor.form.general.title")}
subtitle={t(`pages.createMonitor.form.general.description.${watchedType}`)} subtitle={t(`pages.createMonitor.form.general.description.${watchedType}`)}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
{/* URL/Host/Container field - not shown for hardware */} {/* URL/Host/Container field - not shown for hardware */}
{generalSettingsConfig.showUrl && ( {generalSettingsConfig.showUrl && (
<Controller <Controller
@@ -556,7 +557,7 @@ const CreateMonitorPage = () => {
title={t("pages.createMonitor.form.thresholds.title")} title={t("pages.createMonitor.form.thresholds.title")}
subtitle={t("pages.createMonitor.form.thresholds.description")} subtitle={t("pages.createMonitor.form.thresholds.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="cpuAlertThreshold" name="cpuAlertThreshold"
control={control} control={control}
@@ -638,7 +639,7 @@ const CreateMonitorPage = () => {
title={t("pages.createMonitor.form.incidents.title")} title={t("pages.createMonitor.form.incidents.title")}
subtitle={t("pages.createMonitor.form.incidents.description")} subtitle={t("pages.createMonitor.form.incidents.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(12)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="statusWindowSize" name="statusWindowSize"
control={control} control={control}
@@ -690,7 +691,7 @@ const CreateMonitorPage = () => {
(field.value ?? []).includes(n.id) (field.value ?? []).includes(n.id)
); );
return ( return (
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Autocomplete <Autocomplete
multiple multiple
options={notificationOptions} options={notificationOptions}
@@ -753,7 +754,7 @@ const CreateMonitorPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(2)} spacing={theme.spacing(SPACING.LG)}
> >
<Switch <Switch
checked={field.value ?? false} checked={field.value ?? false}
@@ -774,7 +775,7 @@ const CreateMonitorPage = () => {
title={t("pages.createMonitor.form.advanced.title")} title={t("pages.createMonitor.form.advanced.title")}
subtitle={t("pages.createMonitor.form.advanced.description")} subtitle={t("pages.createMonitor.form.advanced.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="useAdvancedMatching" name="useAdvancedMatching"
control={control} control={control}
@@ -782,7 +783,7 @@ const CreateMonitorPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(2)} spacing={theme.spacing(SPACING.LG)}
> >
<Switch <Switch
checked={field.value ?? false} checked={field.value ?? false}
@@ -797,7 +798,7 @@ const CreateMonitorPage = () => {
)} )}
/> />
{watchedUseAdvancedMatching && ( {watchedUseAdvancedMatching && (
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="matchMethod" name="matchMethod"
control={control} control={control}
@@ -889,7 +890,7 @@ const CreateMonitorPage = () => {
title={t("pages.createMonitor.form.geoChecks.title")} title={t("pages.createMonitor.form.geoChecks.title")}
subtitle={t("pages.createMonitor.form.geoChecks.description")} subtitle={t("pages.createMonitor.form.geoChecks.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="geoCheckEnabled" name="geoCheckEnabled"
control={control} control={control}
@@ -897,7 +898,7 @@ const CreateMonitorPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(2)} spacing={theme.spacing(SPACING.LG)}
> >
<Switch <Switch
checked={field.value ?? false} checked={field.value ?? false}
@@ -910,7 +911,7 @@ const CreateMonitorPage = () => {
)} )}
/> />
{watchGeoCheckEnabled && ( {watchGeoCheckEnabled && (
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="geoCheckLocations" name="geoCheckLocations"
control={control} control={control}
@@ -926,7 +927,7 @@ const CreateMonitorPage = () => {
(field.value ?? []).includes(loc.id) (field.value ?? []).includes(loc.id)
); );
return ( return (
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Autocomplete <Autocomplete
multiple multiple
options={locationOptions} options={locationOptions}
@@ -3,6 +3,7 @@ import Grid from "@mui/material/Grid";
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import { BaseBox, ValueLabel } from "@/Components/design-elements"; import { BaseBox, ValueLabel } from "@/Components/design-elements";
import { LAYOUT } from "@/Utils/Theme/constants";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import type { Incident } from "@/Types/Incident"; import type { Incident } from "@/Types/Incident";
@@ -29,14 +30,14 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
} }
return ( return (
<Stack <Stack
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.MD)}
sx={sx} sx={sx}
> >
<Typography textTransform={"uppercase"}> <Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.title")} {t("pages.incidents.dialog.details.title")}
</Typography> </Typography>
<BaseBox padding={8}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<Typography textTransform={"uppercase"}> <Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.overview")} {t("pages.incidents.dialog.details.overview")}
</Typography> </Typography>
@@ -44,7 +45,7 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
<Grid <Grid
container container
spacing={theme.spacing(4)} spacing={theme.spacing(LAYOUT.MD)}
alignItems="center" alignItems="center"
> >
<Grid size={2}>{t("pages.incidents.dialog.details.status")}</Grid> <Grid size={2}>{t("pages.incidents.dialog.details.status")}</Grid>
@@ -75,15 +76,15 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
</Grid> </Grid>
</Stack> </Stack>
</BaseBox> </BaseBox>
<BaseBox padding={8}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<Typography textTransform={"uppercase"}> <Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.analysis")} {t("pages.incidents.dialog.details.analysis")}
</Typography> </Typography>
<Divider /> <Divider />
<Grid <Grid
container container
spacing={theme.spacing(2)} spacing={theme.spacing(LAYOUT.MD)}
> >
<Grid size={6}> <Grid size={6}>
<Typography>{t("pages.incidents.dialog.details.timeline")}</Typography> <Typography>{t("pages.incidents.dialog.details.timeline")}</Typography>
@@ -127,15 +128,15 @@ export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
</Stack> </Stack>
</BaseBox> </BaseBox>
{!incident.status && ( {!incident.status && (
<BaseBox padding={8}> <BaseBox padding={LAYOUT.MD}>
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(LAYOUT.XS)}>
<Typography textTransform={"uppercase"}> <Typography textTransform={"uppercase"}>
{t("pages.incidents.dialog.details.resolutionDetails")} {t("pages.incidents.dialog.details.resolutionDetails")}
</Typography> </Typography>
<Divider /> <Divider />
<Grid <Grid
container container
spacing={theme.spacing(2)} spacing={theme.spacing(LAYOUT.MD)}
alignItems="center" alignItems="center"
> >
<Grid size={2}> <Grid size={2}>
@@ -3,6 +3,7 @@ import MenuItem from "@mui/material/MenuItem";
import { logger } from "@/Utils/logger"; import { logger } from "@/Utils/logger";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import { BasePage, ConfigBox } from "@/Components/design-elements"; import { BasePage, ConfigBox } from "@/Components/design-elements";
import { import {
TextField, TextField,
@@ -121,7 +122,7 @@ const CreateMaintenanceWindowPage = () => {
title={t("pages.maintenanceWindow.form.general.title")} title={t("pages.maintenanceWindow.form.general.title")}
subtitle={t("pages.maintenanceWindow.form.general.description")} subtitle={t("pages.maintenanceWindow.form.general.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="name" name="name"
control={control} control={control}
@@ -171,7 +172,7 @@ const CreateMaintenanceWindowPage = () => {
title={t("pages.maintenanceWindow.form.startDate.title")} title={t("pages.maintenanceWindow.form.startDate.title")}
subtitle={t("pages.maintenanceWindow.form.startDate.description")} subtitle={t("pages.maintenanceWindow.form.startDate.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="startDate" name="startDate"
control={control} control={control}
@@ -198,7 +199,7 @@ const CreateMaintenanceWindowPage = () => {
title={t("pages.maintenanceWindow.form.startTime.title")} title={t("pages.maintenanceWindow.form.startTime.title")}
subtitle={t("pages.maintenanceWindow.form.startTime.description")} subtitle={t("pages.maintenanceWindow.form.startTime.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="startTime" name="startTime"
control={control} control={control}
@@ -219,7 +220,7 @@ const CreateMaintenanceWindowPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="flex-start" alignItems="flex-start"
spacing={theme.spacing(4)} spacing={theme.spacing(LAYOUT.MD)}
> >
<Controller <Controller
name="duration" name="duration"
@@ -284,7 +285,7 @@ const CreateMaintenanceWindowPage = () => {
.filter((m): m is Monitor => m !== undefined); .filter((m): m is Monitor => m !== undefined);
return ( return (
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Autocomplete <Autocomplete
multiple multiple
options={monitorsList} options={monitorsList}
@@ -318,9 +319,8 @@ const CreateMaintenanceWindowPage = () => {
key={monitor.id} key={monitor.id}
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(4)} padding={theme.spacing(LAYOUT.XS)}
padding={theme.spacing(4)} marginTop={theme.spacing(SPACING.LG)}
marginTop={theme.spacing(2)}
borderRadius={1} borderRadius={1}
sx={{ sx={{
border: `1px solid ${theme.palette.divider}`, border: `1px solid ${theme.palette.divider}`,
@@ -351,7 +351,7 @@ const CreateMaintenanceWindowPage = () => {
<Stack <Stack
direction="row" direction="row"
justifyContent="flex-end" justifyContent="flex-end"
spacing={theme.spacing(2)} spacing={theme.spacing(SPACING.LG)}
> >
<Button <Button
loading={isLoading} loading={isLoading}
+12 -11
View File
@@ -1,6 +1,7 @@
import { BasePage, ConfigBox, TextLink } from "@/Components/design-elements"; import { BasePage, ConfigBox, TextLink } from "@/Components/design-elements";
import { Autocomplete, Select, Dialog, SwitchComponent } from "@/Components/inputs"; import { Autocomplete, Select, Dialog, SwitchComponent } from "@/Components/inputs";
import { logger } from "@/Utils/logger"; import { logger } from "@/Utils/logger";
import { LAYOUT } from "@/Utils/Theme/constants";
import { import {
Stack, Stack,
useTheme, useTheme,
@@ -299,7 +300,7 @@ export const SettingsPage = () => {
component="form" component="form"
onSubmit={form.handleSubmit(onSubmit, onError)} onSubmit={form.handleSubmit(onSubmit, onError)}
> >
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<ConfigBox <ConfigBox
title={t("pages.settings.form.timezone.title")} title={t("pages.settings.form.timezone.title")}
subtitle={t("pages.settings.form.timezone.description")} subtitle={t("pages.settings.form.timezone.description")}
@@ -322,7 +323,7 @@ export const SettingsPage = () => {
title={t("pages.settings.form.ui.title")} title={t("pages.settings.form.ui.title")}
subtitle={t("pages.settings.form.ui.description")} subtitle={t("pages.settings.form.ui.description")}
rightContent={ rightContent={
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<Select <Select
value={mode} value={mode}
onChange={handleModeChange} onChange={handleModeChange}
@@ -550,7 +551,7 @@ export const SettingsPage = () => {
title={t("pages.settings.form.email.title")} title={t("pages.settings.form.email.title")}
subtitle={t("pages.settings.form.email.description")} subtitle={t("pages.settings.form.email.description")}
leftContent={ leftContent={
<Stack gap={theme.spacing(8)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
<TextLink <TextLink
text={t("pages.settings.form.email.descriptionTransport")} text={t("pages.settings.form.email.descriptionTransport")}
linkText={t("pages.settings.form.email.descriptionTransportLink")} linkText={t("pages.settings.form.email.descriptionTransportLink")}
@@ -598,7 +599,7 @@ export const SettingsPage = () => {
</Stack> </Stack>
} }
rightContent={ rightContent={
<Stack gap={theme.spacing(10)}> <Stack gap={theme.spacing(LAYOUT.MD)}>
{/* Email Host */} {/* Email Host */}
<Controller <Controller
name="systemEmailHost" name="systemEmailHost"
@@ -685,7 +686,7 @@ export const SettingsPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.XS)}
> >
<Button <Button
variant="contained" variant="contained"
@@ -760,7 +761,7 @@ export const SettingsPage = () => {
sx={{ sx={{
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
gap: theme.spacing(4), gap: theme.spacing(LAYOUT.XS),
}} }}
> >
{[ {[
@@ -879,7 +880,7 @@ export const SettingsPage = () => {
subtitle={t("pages.settings.form.importExportMonitors.description")} subtitle={t("pages.settings.form.importExportMonitors.description")}
rightContent={ rightContent={
<Stack <Stack
gap={theme.spacing(4)} gap={theme.spacing(LAYOUT.MD)}
direction={"row"} direction={"row"}
> >
<input <input
@@ -965,10 +966,10 @@ export const SettingsPage = () => {
bottom: 0, bottom: 0,
backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
borderTop: `1px solid ${theme.palette.divider}`, borderTop: `1px solid ${theme.palette.divider}`,
padding: theme.spacing(8), padding: theme.spacing(LAYOUT.MD),
marginLeft: theme.spacing(-8), marginLeft: theme.spacing(-LAYOUT.MD),
marginRight: theme.spacing(-8), marginRight: theme.spacing(-LAYOUT.MD),
marginBottom: theme.spacing(-8), marginBottom: theme.spacing(-LAYOUT.MD),
zIndex: 1000, zIndex: 1000,
}} }}
> >
+9 -8
View File
@@ -1,6 +1,7 @@
import { BasePage, ConfigBox } from "@/Components/design-elements"; import { BasePage, ConfigBox } from "@/Components/design-elements";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import { logger } from "@/Utils/logger"; import { logger } from "@/Utils/logger";
import { SPACING, LAYOUT } from "@/Utils/Theme/constants";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import FormControlLabel from "@mui/material/FormControlLabel"; import FormControlLabel from "@mui/material/FormControlLabel";
@@ -166,7 +167,7 @@ const CreateStatusPage = () => {
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(2)} spacing={theme.spacing(SPACING.MD)}
> >
<Controller <Controller
name="isPublished" name="isPublished"
@@ -188,7 +189,7 @@ const CreateStatusPage = () => {
title={t("pages.statusPages.form.basicInfo.title")} title={t("pages.statusPages.form.basicInfo.title")}
subtitle={t("pages.statusPages.form.basicInfo.description")} subtitle={t("pages.statusPages.form.basicInfo.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(6)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="companyName" name="companyName"
control={control} control={control}
@@ -243,7 +244,7 @@ const CreateStatusPage = () => {
}; };
return ( return (
<Stack spacing={theme.spacing(4)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Autocomplete <Autocomplete
multiple multiple
options={monitors} options={monitors}
@@ -291,9 +292,9 @@ const CreateStatusPage = () => {
{...provided.dragHandleProps} {...provided.dragHandleProps}
direction="row" direction="row"
alignItems="center" alignItems="center"
spacing={theme.spacing(4)} spacing={theme.spacing(LAYOUT.XS)}
padding={theme.spacing(4)} padding={theme.spacing(LAYOUT.XS)}
marginTop={theme.spacing(2)} marginTop={theme.spacing(SPACING.LG)}
borderRadius={1} borderRadius={1}
sx={{ sx={{
border: `1px solid ${theme.palette.divider}`, border: `1px solid ${theme.palette.divider}`,
@@ -367,7 +368,7 @@ const CreateStatusPage = () => {
title={t("pages.statusPages.form.appearance.title")} title={t("pages.statusPages.form.appearance.title")}
subtitle={t("pages.statusPages.form.appearance.description")} subtitle={t("pages.statusPages.form.appearance.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(8)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Stack alignItems={"center"}> <Stack alignItems={"center"}>
<Controller <Controller
name="logo" name="logo"
@@ -408,7 +409,7 @@ const CreateStatusPage = () => {
title={t("pages.statusPages.form.features.title")} title={t("pages.statusPages.form.features.title")}
subtitle={t("pages.statusPages.form.features.description")} subtitle={t("pages.statusPages.form.features.description")}
rightContent={ rightContent={
<Stack spacing={theme.spacing(2)}> <Stack spacing={theme.spacing(LAYOUT.MD)}>
<Controller <Controller
name="showCharts" name="showCharts"
control={control} control={control}
+17
View File
@@ -0,0 +1,17 @@
export const SPACING = {
XS: 0.5,
SM: 1,
MD: 1.5,
LG: 2,
XL: 2.5,
XXL: 3,
} as const;
export const LAYOUT = {
XS: 4,
SM: 6,
MD: 8,
LG: 10,
XL: 12,
XXL: 16,
} as const;