61 lines
1.3 KiB
React
61 lines
1.3 KiB
React
import ChartBox from "@/Components/v1/Charts/ChartBox/index.jsx";
|
|
import AreaChart from "../Charts/AreaChart.jsx";
|
|
import AreaChartLegend from "../Charts/AreaChartLegend.jsx";
|
|
import SkeletonLayout from "./skeleton.jsx";
|
|
import Icon from "@/Components/v1/Icon";
|
|
import { Stack } from "@mui/material";
|
|
import PropTypes from "prop-types";
|
|
|
|
import { useTheme } from "@emotion/react";
|
|
|
|
const PageSpeedAreaChart = ({ shouldRender, monitor, metrics, handleMetrics }) => {
|
|
const theme = useTheme();
|
|
|
|
if (!shouldRender) {
|
|
return <SkeletonLayout />;
|
|
}
|
|
|
|
const data = monitor?.checks ? [...monitor.checks].reverse() : [];
|
|
|
|
return (
|
|
<Stack
|
|
direction="row"
|
|
gap={theme.spacing(10)}
|
|
>
|
|
<ChartBox
|
|
justifyContent="flex-start"
|
|
icon={
|
|
<Icon
|
|
name="TrendingUp"
|
|
size={20}
|
|
/>
|
|
}
|
|
header="Score history"
|
|
height="100%"
|
|
borderRadiusRight={16}
|
|
Legend={
|
|
<AreaChartLegend
|
|
metrics={metrics}
|
|
handleMetrics={handleMetrics}
|
|
/>
|
|
}
|
|
>
|
|
<AreaChart
|
|
data={data}
|
|
monitor={monitor}
|
|
metrics={metrics}
|
|
/>
|
|
</ChartBox>
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
PageSpeedAreaChart.propTypes = {
|
|
shouldRender: PropTypes.bool,
|
|
monitor: PropTypes.object,
|
|
metrics: PropTypes.object,
|
|
handleMetrics: PropTypes.func,
|
|
};
|
|
|
|
export default PageSpeedAreaChart;
|