diff --git a/Client/src/Pages/Monitors/utils.jsx b/Client/src/Pages/Monitors/utils.jsx
index c6f0a8476..cc079fedc 100644
--- a/Client/src/Pages/Monitors/utils.jsx
+++ b/Client/src/Pages/Monitors/utils.jsx
@@ -52,12 +52,35 @@ const useUtils = () => {
"& h2": { color: theme.palette.warning.main },
},
};
+ const pagespeedStyles = {
+ up: {
+ bg: theme.palette.success.bg,
+ light: theme.palette.success.light,
+ stroke: theme.palette.success.main,
+ },
+ down: {
+ bg: theme.palette.error.bg,
+ light: theme.palette.error.light,
+ stroke: theme.palette.error.main,
+ },
+ paused: {
+ bg: theme.palette.warning.bg,
+ light: theme.palette.warning.light,
+ stroke: theme.palette.warning.main,
+ },
+ pending: {
+ bg: theme.palette.warning.bg,
+ light: theme.palette.warning.light,
+ stroke: theme.palette.warning.main,
+ },
+ };
return {
determineState,
statusColor,
statusMsg,
pagespeedStatusMsg,
+ pagespeedStyles,
statusStyles,
};
};
diff --git a/Client/src/Pages/PageSpeed/card.jsx b/Client/src/Pages/PageSpeed/card.jsx
index eeb1c77a7..00b717ce4 100644
--- a/Client/src/Pages/PageSpeed/card.jsx
+++ b/Client/src/Pages/PageSpeed/card.jsx
@@ -1,19 +1,103 @@
import PageSpeedIcon from "../../assets/icons/page-speed.svg?react";
import { StatusLabel } from "../../Components/Label";
-import { Box, Grid, Stack, Typography } from "@mui/material";
+import { Box, Grid, Typography } from "@mui/material";
import { useNavigate } from "react-router";
import { useTheme } from "@emotion/react";
-import { formatDate, formatDurationRounded } from "../../Utils/timeUtils";
-import { getLastChecked } from "../../Utils/monitorUtils";
+import { IconBox } from "./Details/styled";
import useUtils from "../Monitors/utils";
import PropTypes from "prop-types";
-import { IconBox } from "./Details/styled";
+import { Area, AreaChart, CartesianGrid, ResponsiveContainer } from "recharts";
+
+const processData = (data) => {
+ if (data.length === 0) return [];
+ let formattedData = [];
+
+ const calculateScore = (entry) => {
+ return (
+ (entry.accessibility +
+ entry.bestPractices +
+ entry.performance +
+ entry.seo) /
+ 4
+ );
+ };
+
+ data.forEach((entry) => {
+ entry = { ...entry, score: calculateScore(entry) };
+ formattedData.push(entry);
+ });
+
+ return formattedData;
+};
+
+const PagespeedAreaChart = ({ data, status }) => {
+ const theme = useTheme();
+ const { pagespeedStyles } = useUtils();
+
+ const formattedData = processData(data);
+
+ return (
+
+
+
+ {/* }
+ /> */}
+
+
+
+
+
+
+
+
+
+ );
+};
const Card = ({ monitor }) => {
const { determineState, pagespeedStatusMsg } = useUtils();
const theme = useTheme();
const navigate = useNavigate();
const monitorState = determineState(monitor);
+
return (
{
>
{monitor.url}
+
+
+
);
diff --git a/Client/src/Pages/PageSpeed/index.jsx b/Client/src/Pages/PageSpeed/index.jsx
index 68da033e4..a76e4cca1 100644
--- a/Client/src/Pages/PageSpeed/index.jsx
+++ b/Client/src/Pages/PageSpeed/index.jsx
@@ -56,7 +56,6 @@ const PageSpeed = ({ isAdmin }) => {
// will show skeletons only on initial load
// since monitor state is being added to redux persist, there's no reason to display skeletons on every render
let isActuallyLoading = isLoading && monitors?.length === 0;
-
return (
{
variant="contained"
color="primary"
onClick={() => navigate("/pagespeed/create")}
+ sx={{ whiteSpace: "nowrap" }}
>
Create new