Merge pull request #8 from uprockcom/feat/ticker-redesign
feat: ticker redesign
This commit is contained in:
3 files changed
+50
-27
No files matched your search
@@ -132,7 +132,7 @@ StatBox.propTypes = {
|
|||||||
gradient: PropTypes.bool,
|
gradient: PropTypes.bool,
|
||||||
status: PropTypes.string,
|
status: PropTypes.string,
|
||||||
sx: PropTypes.object,
|
sx: PropTypes.object,
|
||||||
icon: PropTypes.node,
|
icon: PropTypes.elementType,
|
||||||
img: PropTypes.node,
|
img: PropTypes.node,
|
||||||
alt: PropTypes.string,
|
alt: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Stack, Typography, List, ListItem } from "@mui/material";
|
import { Stack, Typography } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import PulseDot from "../../../../../Components/Animated/PulseDot";
|
import PulseDot from "../../../../../Components/Animated/PulseDot";
|
||||||
import "flag-icons/css/flag-icons.min.css";
|
import "flag-icons/css/flag-icons.min.css";
|
||||||
|
import { styled } from "@mui/material/styles";
|
||||||
|
|
||||||
const BASE_BOX_PADDING_VERTICAL = 16;
|
const BASE_BOX_PADDING_VERTICAL = 16;
|
||||||
const BASE_BOX_PADDING_HORIZONTAL = 8;
|
const BASE_BOX_PADDING_HORIZONTAL = 8;
|
||||||
@@ -23,12 +24,12 @@ const DeviceTicker = ({ data, width = "100%", connectionStatus }) => {
|
|||||||
backgroundColor: theme.palette.background.main,
|
backgroundColor: theme.palette.background.main,
|
||||||
border: 1,
|
border: 1,
|
||||||
borderStyle: "solid",
|
borderStyle: "solid",
|
||||||
|
borderRadius: theme.spacing(4),
|
||||||
borderColor: theme.palette.primary.lowContrast,
|
borderColor: theme.palette.primary.lowContrast,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
justifyContent={"center"}
|
|
||||||
gap={theme.spacing(4)}
|
gap={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
<PulseDot color={statusColor[connectionStatus]} />
|
<PulseDot color={statusColor[connectionStatus]} />
|
||||||
@@ -41,29 +42,52 @@ const DeviceTicker = ({ data, width = "100%", connectionStatus }) => {
|
|||||||
{connectionStatus === "up" ? "Connected" : "No connection"}
|
{connectionStatus === "up" ? "Connected" : "No connection"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<List>
|
<table>
|
||||||
{data.slice(Math.max(data.length - 5, 0)).map((dataPoint) => {
|
<thead>
|
||||||
const countryCode = dataPoint?.countryCode?.toLowerCase() ?? null;
|
<tr>
|
||||||
const flag = countryCode ? `fi fi-${countryCode}` : null;
|
<th style={{ textAlign: "left" }}>
|
||||||
return (
|
<Typography>COUNTRY</Typography>
|
||||||
<ListItem key={Math.random()}>
|
</th>
|
||||||
<Stack direction="column">
|
<th style={{ textAlign: "left" }}>
|
||||||
<Stack
|
<Typography>CITY</Typography>
|
||||||
direction="row"
|
</th>
|
||||||
alignItems="center"
|
<th style={{ textAlign: "right" }}>
|
||||||
gap={theme.spacing(4)}
|
<Typography>RESPONSE</Typography>
|
||||||
>
|
</th>
|
||||||
{flag && <span className={flag} />}
|
<th style={{ textAlign: "right" }}>
|
||||||
<Typography variant="h2">{dataPoint?.city || "Unknown"}</Typography>
|
<Typography>UPT BURNED</Typography>
|
||||||
</Stack>
|
</th>
|
||||||
<Typography variant="p">{`Response time: ${Math.floor(dataPoint?.responseTime ?? 0)} ms`}</Typography>
|
</tr>
|
||||||
<Typography variant="p">{`UPT burned: ${dataPoint.uptBurnt}`}</Typography>
|
</thead>
|
||||||
<Typography variant="p">{`${dataPoint?.device?.manufacturer} ${dataPoint?.device?.model}`}</Typography>
|
<tbody>
|
||||||
</Stack>
|
{data.map((dataPoint) => {
|
||||||
</ListItem>
|
const countryCode = dataPoint?.countryCode?.toLowerCase() ?? null;
|
||||||
);
|
const flag = countryCode ? `fi fi-${countryCode}` : null;
|
||||||
})}
|
const city = dataPoint?.city !== "" ? dataPoint?.city : "Unknown";
|
||||||
</List>
|
return (
|
||||||
|
<tr key={Math.random()}>
|
||||||
|
<td style={{ padding: theme.spacing(4) }}>
|
||||||
|
<Typography>
|
||||||
|
{flag ? <span className={flag} /> : null}{" "}
|
||||||
|
{countryCode?.toUpperCase() ?? "N/A"}
|
||||||
|
</Typography>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Typography>{city}</Typography>
|
||||||
|
</td>
|
||||||
|
<td style={{ textAlign: "right" }}>
|
||||||
|
<Typography>{Math.floor(dataPoint.responseTime)} ms</Typography>
|
||||||
|
</td>
|
||||||
|
<td style={{ textAlign: "right" }}>
|
||||||
|
<Typography color={theme.palette.warning.main}>
|
||||||
|
+{dataPoint.uptBurnt}
|
||||||
|
</Typography>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ const DistributedUptimeStatus = () => {
|
|||||||
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
|
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
|
||||||
useSubscribeToDetails({ monitorId, dateRange, isPublic, isPublished });
|
useSubscribeToDetails({ monitorId, dateRange, isPublic, isPublished });
|
||||||
|
|
||||||
console.log(monitor);
|
|
||||||
const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => {
|
const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => {
|
||||||
navigate("/distributed-uptime");
|
navigate("/distributed-uptime");
|
||||||
}, url);
|
}, url);
|
||||||
|
|||||||
Reference in new issue
Block a user