diff --git a/Client/src/Pages/Monitors/Details/styled.jsx b/Client/src/Pages/Monitors/Details/styled.jsx index 99112802d..7f580d7c7 100644 --- a/Client/src/Pages/Monitors/Details/styled.jsx +++ b/Client/src/Pages/Monitors/Details/styled.jsx @@ -76,6 +76,7 @@ export const StatBox = styled(Box)(({ theme }) => ({ borderColor: theme.palette.border.light, borderRadius: 4, backgroundColor: theme.palette.background.main, + background: `linear-gradient(340deg, ${theme.palette.background.accent} 20%, ${theme.palette.background.main} 35%)`, "& h2": { fontSize: 13, fontWeight: 500, diff --git a/Client/src/Pages/Monitors/utils.jsx b/Client/src/Pages/Monitors/utils.jsx index 0551a65aa..ede5baec1 100644 --- a/Client/src/Pages/Monitors/utils.jsx +++ b/Client/src/Pages/Monitors/utils.jsx @@ -23,22 +23,26 @@ const useUtils = () => { const statusStyles = { up: { backgroundColor: theme.palette.success.bg, + background: `linear-gradient(340deg, ${theme.palette.success.light} -60%, ${theme.palette.success.bg} 35%)`, borderColor: theme.palette.success.light, "& h2": { color: theme.palette.success.main }, }, down: { backgroundColor: theme.palette.error.bg, + background: `linear-gradient(340deg, ${theme.palette.error.light} -60%, ${theme.palette.error.bg} 35%)`, borderColor: theme.palette.error.light, "& h2": { color: theme.palette.error.main }, }, paused: { backgroundColor: theme.palette.warning.light, - borderColor: theme.palette.warning.border, + background: `linear-gradient(340deg, ${theme.palette.warning.dark} -60%, ${theme.palette.warning.light} 35%)`, + borderColor: theme.palette.warning.dark, "& h2": { color: theme.palette.warning.main }, }, pending: { backgroundColor: theme.palette.warning.light, - borderColor: theme.palette.warning.border, + background: `linear-gradient(340deg, ${theme.palette.warning.dark} -60%, ${theme.palette.warning.light} 35%)`, + borderColor: theme.palette.warning.dark, "& h2": { color: theme.palette.warning.main }, }, }; diff --git a/Client/src/Pages/PageSpeed/Details/index.css b/Client/src/Pages/PageSpeed/Details/index.css index 1da62a362..e3279bdf9 100644 --- a/Client/src/Pages/PageSpeed/Details/index.css +++ b/Client/src/Pages/PageSpeed/Details/index.css @@ -1,12 +1,7 @@ -.page-speed-details h1 { - font-size: var(--env-var-font-size-large-plus); -} -.page-speed-details h2, .page-speed-details h6 { font-size: var(--env-var-font-size-large); } .page-speed-details h4, -.page-speed-details p, .page-speed-details p > span { font-size: var(--env-var-font-size-medium); } @@ -17,8 +12,6 @@ .page-speed-details h6 { line-height: 22px; } -.page-speed-details h1, -.page-speed-details h2, .page-speed-details h6 { font-weight: 600; } diff --git a/Client/src/Pages/PageSpeed/Details/index.jsx b/Client/src/Pages/PageSpeed/Details/index.jsx index 4004e1715..85af38952 100644 --- a/Client/src/Pages/PageSpeed/Details/index.jsx +++ b/Client/src/Pages/PageSpeed/Details/index.jsx @@ -1,5 +1,13 @@ import PropTypes from "prop-types"; -import { Box, Button, Skeleton, Stack, Typography } from "@mui/material"; +import { + Box, + Button, + Skeleton, + Stack, + Toolbar, + Tooltip, + Typography, +} from "@mui/material"; import { PieChart } from "@mui/x-charts/PieChart"; import { useDrawingArea } from "@mui/x-charts"; import { useEffect, useState } from "react"; @@ -9,7 +17,9 @@ import { useSelector } from "react-redux"; import { formatDuration, formatDurationRounded, + formatDurationSplit, } from "../../../Utils/timeUtils"; +import { StatBox } from "./styled"; import { logger } from "../../../Utils/Logger"; import { networkService } from "../../../main"; import SettingsIcon from "../../../assets/icons/settings-bold.svg?react"; @@ -21,46 +31,6 @@ import Breadcrumbs from "../../../Components/Breadcrumbs"; import PulseDot from "../../../Components/Animated/PulseDot"; import "./index.css"; -const StatBox = ({ icon, title, value }) => { - const theme = useTheme(); - - return ( - - {icon} - - - {title} - - - {value} - - - - ); -}; - -StatBox.propTypes = { - icon: PropTypes.element, - title: PropTypes.string, - value: PropTypes.node, -}; - /** * Renders a centered label within a pie chart. * @@ -356,8 +326,21 @@ const PageSpeedDetails = () => { borderRadius: theme.shape.borderRadius, backgroundColor: theme.palette.background.main, }; + + console.log(monitor); + + const splitDuration = (duration) => { + const { time, format } = formatDurationSplit(duration); + return ( + <> + {time} + {format} + + ); + }; + return ( - + {loading ? ( ) : ( @@ -369,32 +352,82 @@ const PageSpeedDetails = () => { ]} /> - - {monitor?.url} + {monitor.name} - - Your pagespeed monitor is live. - + + + + + + + {monitor?.url} + + + Checking every {formatDurationRounded(monitor?.interval)}. + + - - } - title="Last checked" - value={ - <> - {formatDuration(monitor?.lastChecked)}{" "} - - ago - - - } - /> - } - title="Checks since" - value={ - <> - {formatDuration(monitor?.uptimeDuration)}{" "} - - ago - - - } - > - } - title="Checks every" - value={formatDurationRounded(monitor?.interval)} - > + + + checks since + + {splitDuration(monitor?.uptimeDuration)} + ago + + + + last check + + {splitDuration(monitor?.lastChecked)} + ago + + Score history diff --git a/Client/src/Pages/PageSpeed/Details/styled.jsx b/Client/src/Pages/PageSpeed/Details/styled.jsx new file mode 100644 index 000000000..cae50839e --- /dev/null +++ b/Client/src/Pages/PageSpeed/Details/styled.jsx @@ -0,0 +1,29 @@ +import { Box, styled } from "@mui/material"; + +export const StatBox = styled(Box)(({ theme }) => ({ + padding: `${theme.spacing(4)} ${theme.spacing(8)}`, + minWidth: 200, + width: 225, + border: 1, + borderStyle: "solid", + borderColor: theme.palette.border.light, + borderRadius: 4, + backgroundColor: theme.palette.background.main, + background: `linear-gradient(340deg, ${theme.palette.background.accent} 20%, ${theme.palette.background.main} 35%)`, + "& h2": { + fontSize: 13, + fontWeight: 500, + color: theme.palette.text.secondary, + textTransform: "uppercase", + }, + "& p": { + fontSize: 18, + color: theme.palette.text.primary, + marginTop: theme.spacing(2), + "& span": { + color: theme.palette.text.tertiary, + marginLeft: theme.spacing(2), + fontSize: 15, + }, + }, +}));