Files
Checkmate/client/src/Pages/PageSpeed/Details/Components/PageSpeedAreaChart/index.jsx
T

60 lines
1.3 KiB
React
Raw Normal View History

2025-09-27 14:54:55 -07:00
import ChartBox from "@/Components/v1/Charts/ChartBox/index.jsx";
2025-09-25 10:11:41 -07:00
import AreaChart from "../Charts/AreaChart.jsx";
import AreaChartLegend from "../Charts/AreaChartLegend.jsx";
import SkeletonLayout from "./skeleton.jsx";
import Icon from "@/Components/v1/Icon";
2025-01-28 15:42:46 -08:00
import { Stack } from "@mui/material";
2025-01-28 15:51:58 -08:00
import PropTypes from "prop-types";
2025-01-28 15:42:46 -08:00
import { useTheme } from "@emotion/react";
const PageSpeedAreaChart = ({ shouldRender, monitor, metrics, handleMetrics }) => {
const theme = useTheme();
2025-01-28 15:51:58 -08:00
if (!shouldRender) {
return <SkeletonLayout />;
}
2025-01-28 15:42:46 -08:00
const data = monitor?.checks ? [...monitor.checks].reverse() : [];
return (
<Stack
direction="row"
gap={theme.spacing(10)}
>
<ChartBox
justifyContent="flex-start"
2026-01-15 23:39:26 -05:00
icon={
<Icon
name="TrendingUp"
size={20}
/>
}
2025-01-28 15:42:46 -08:00
header="Score history"
height="100%"
borderRadiusRight={16}
Legend={
<AreaChartLegend
metrics={metrics}
handleMetrics={handleMetrics}
/>
}
>
<AreaChart
data={data}
monitor={monitor}
metrics={metrics}
/>
</ChartBox>
</Stack>
);
};
2025-01-28 15:51:58 -08:00
PageSpeedAreaChart.propTypes = {
shouldRender: PropTypes.bool,
monitor: PropTypes.object,
metrics: PropTypes.object,
handleMetrics: PropTypes.func,
};
2025-01-28 15:42:46 -08:00
export default PageSpeedAreaChart;