extract subcomponents
This commit is contained in:
1 parent
e5ade000c3
commit
cceab2b705
3 files changed
+93
No files matched your search
+8
@@ -8,6 +8,8 @@ import {
|
|||||||
ResponsiveContainer,
|
ResponsiveContainer,
|
||||||
Text,
|
Text,
|
||||||
} from "recharts";
|
} from "recharts";
|
||||||
|
import ChartBox from "../../../../../Components/Charts/ChartBox";
|
||||||
|
import ResponseTimeIcon from "../../../../../assets/icons/response-time-icon.svg?react";
|
||||||
import { Box, Stack, Typography } from "@mui/material";
|
import { Box, Stack, Typography } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -22,6 +24,11 @@ const CustomToolTip = ({ active, payload, label }) => {
|
|||||||
? payload[0]?.payload?.originalAvgResponseTime
|
? payload[0]?.payload?.originalAvgResponseTime
|
||||||
: (payload[0]?.payload?.avgResponseTime ?? 0);
|
: (payload[0]?.payload?.avgResponseTime ?? 0);
|
||||||
return (
|
return (
|
||||||
|
<ChartBox
|
||||||
|
icon={<ResponseTimeIcon />}
|
||||||
|
header="Response Times"
|
||||||
|
sx={{ padding: 0 }}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
className="area-tooltip"
|
className="area-tooltip"
|
||||||
sx={{
|
sx={{
|
||||||
@@ -83,6 +90,7 @@ const CustomToolTip = ({ active, payload, label }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
{/* Display original value */}
|
{/* Display original value */}
|
||||||
</Box>
|
</Box>
|
||||||
|
</ChartBox>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { Stack, Typography } from "@mui/material";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const MonitorHeader = ({ monitor }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
return (
|
||||||
|
<Stack direction="row">
|
||||||
|
<Stack gap={theme.spacing(2)}>
|
||||||
|
<Typography variant="h1">{monitor.name}</Typography>
|
||||||
|
<Typography variant="h2">
|
||||||
|
Distributed Uptime Monitoring powered by DePIN
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
MonitorHeader.propTypes = {
|
||||||
|
monitor: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MonitorHeader;
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
// Components
|
||||||
|
import { Stack } from "@mui/material";
|
||||||
|
import StatBox from "../../../../../Components/StatBox";
|
||||||
|
import LastUpdate from "../LastUpdate";
|
||||||
|
import UptLogo from "../../../../../assets/icons/upt_logo.png";
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const StatBoxes = ({ monitor, lastUpdateTrigger }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(8)}
|
||||||
|
>
|
||||||
|
<StatBox
|
||||||
|
heading="Avg Response Time"
|
||||||
|
subHeading={`${Math.floor(monitor?.avgResponseTime ?? 0)} ms`}
|
||||||
|
/>
|
||||||
|
<StatBox
|
||||||
|
heading="Checking every"
|
||||||
|
subHeading={`${(monitor?.interval ?? 0) / 1000} seconds`}
|
||||||
|
/>
|
||||||
|
<StatBox
|
||||||
|
heading={"Last check"}
|
||||||
|
subHeading={
|
||||||
|
<LastUpdate
|
||||||
|
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
|
||||||
|
suffix={"seconds ago"}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<StatBox
|
||||||
|
heading="Last server push"
|
||||||
|
subHeading={
|
||||||
|
<LastUpdate
|
||||||
|
suffix={"seconds ago"}
|
||||||
|
lastUpdateTime={0}
|
||||||
|
trigger={lastUpdateTrigger}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<StatBox
|
||||||
|
heading="UPT Burned"
|
||||||
|
subHeading={monitor?.totalUptBurnt ?? 0}
|
||||||
|
img={UptLogo}
|
||||||
|
alt="Upt Logo"
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
StatBoxes.propTypes = {
|
||||||
|
monitor: PropTypes.object,
|
||||||
|
lastUpdateTrigger: PropTypes.number,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StatBoxes;
|
||||||
Reference in new issue
Block a user