import { getLastChecked } from "../../Utils/monitorUtils"; import { formatDate, formatDurationRounded } from "../../Utils/timeUtils"; import PageSpeedIcon from "../../assets/icons/page-speed.svg?react"; import { StatusLabel } from "../../Components/Label"; import { Box, Grid, Stack, Typography } from "@mui/material"; import { useNavigate } from "react-router"; import { useTheme } from "@emotion/react"; import PropTypes from "prop-types"; const Card = ({ data }) => { const theme = useTheme(); const navigate = useNavigate(); return ( .MuiStack-root": { backgroundColor: theme.palette.background.accent, }, }} > navigate(`/pagespeed/${data._id}`)} border={1} borderColor={theme.palette.border.light} borderRadius={theme.shape.borderRadius} backgroundColor={theme.palette.background.main} sx={{ cursor: "pointer", "& svg path": { stroke: theme.palette.other.icon, strokeWidth: 0.8 }, }} > {data.name} {data.url.replace(/^https?:\/\//, "")} Last checked:{" "} {formatDate(getLastChecked(data.checks, false))}{" "} ({formatDurationRounded(getLastChecked(data.checks))} ago) ); }; Card.propTypes = { data: PropTypes.object.isRequired, }; export default Card;