Refactored status dot to its own component

This commit is contained in:
Daniel Cojocea committed 2024-08-22 12:23:52 -04:00
1 parent 35ae180865
commit 50c23505c3
5 files changed
+77 -122

No files matched your search

@@ -0,0 +1,33 @@
import { Box, Stack } from "@mui/material";
const PulseDot = ({ color }) => {
return (
<Stack
width="26px"
height="24px"
alignItems="center"
justifyContent="center"
>
<Box
width="14px"
height="14px"
sx={{
position: "relative",
backgroundColor: color,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
}}
/>
</Stack>
);
};
export default PulseDot;
+13 -32
View File
@@ -2,22 +2,23 @@ import { useNavigate, useParams } from "react-router";
import { useTheme } from "@emotion/react";
import { useDispatch, useSelector } from "react-redux";
import { useEffect, useState } from "react";
import Button from "../../../Components/Button";
import Field from "../../../Components/Inputs/Field";
import { Box, Modal, Skeleton, Stack, Typography } from "@mui/material";
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
import { monitorValidation } from "../../../Validation/validation";
import Select from "../../../Components/Inputs/Select";
import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger";
import {
updateUptimeMonitor,
getUptimeMonitorsByUserId,
deleteUptimeMonitor,
} from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
import Button from "../../../Components/Button";
import Field from "../../../Components/Inputs/Field";
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
import Select from "../../../Components/Inputs/Select";
import Checkbox from "../../../Components/Inputs/Checkbox";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import PulseDot from "../../../Components/Animated/PulseDot";
import "./index.css";
import { logger } from "../../../Utils/Logger";
/**
* Parses a URL string and returns a URL object.
@@ -228,33 +229,13 @@ const Configure = () => {
flex={1}
>
<Stack direction="row" gap={theme.gap.xs}>
<Stack
width={theme.gap.large}
height={theme.gap.large}
alignItems="center"
justifyContent="center"
>
<Box
width="14px"
height="14px"
sx={{
position: "relative",
backgroundColor: monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
}}
/>
</Stack>
<PulseDot
color={
monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor
}
/>
<Box>
{parsedUrl?.host ? (
<Typography component="h1" mb={theme.gap.xs} lineHeight={1}>
+14 -33
View File
@@ -4,18 +4,19 @@ import { Box, Skeleton, Stack, Typography, useTheme } from "@mui/material";
import { useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
import { networkService } from "../../../main";
import { logger } from "../../../Utils/Logger";
import {
formatDuration,
formatDurationRounded,
} from "../../../Utils/timeUtils";
import MonitorDetailsAreaChart from "../../../Components/Charts/MonitorDetailsAreaChart";
import ButtonGroup from "@mui/material/ButtonGroup";
import Button from "../../../Components/Button";
import SettingsIcon from "../../../assets/icons/settings-bold.svg?react";
import PaginationTable from "./PaginationTable";
import {
formatDuration,
formatDurationRounded,
} from "../../../Utils/timeUtils";
import "./index.css";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import { logger } from "../../../Utils/Logger";
import PulseDot from "../../../Components/Animated/PulseDot";
import "./index.css";
const StatBox = ({ title, value }) => {
return (
@@ -170,33 +171,13 @@ const DetailsPage = () => {
/>
<Stack gap={theme.gap.large} mt={theme.gap.large}>
<Stack direction="row" gap={theme.gap.xs}>
<Stack
width={theme.gap.large}
height={theme.gap.large}
alignItems="center"
justifyContent="center"
>
<Box
width="14px"
height="14px"
sx={{
position: "relative",
backgroundColor: monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
}}
/>
</Stack>
<PulseDot
color={
monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor
}
/>
<Box>
<Typography component="h1" sx={{ lineHeight: 1 }}>
{monitor.url?.replace(/^https?:\/\//, "") || "..."}
+9 -30
View File
@@ -10,15 +10,14 @@ import {
} from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice";
import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger";
import Button from "../../../Components/Button";
import Field from "../../../Components/Inputs/Field";
import Select from "../../../Components/Inputs/Select";
import Checkbox from "../../../Components/Inputs/Checkbox";
import PauseCircleOutlineIcon from "@mui/icons-material/PauseCircleOutline";
import GreenCheck from "../../../assets/icons/checkbox-green.svg?react";
import RedCheck from "../../../assets/icons/checkbox-red.svg?react";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import { logger } from "../../../Utils/Logger";
import PulseDot from "../../../Components/Animated/PulseDot";
import "./index.css";
@@ -169,33 +168,13 @@ const PageSpeedConfigure = () => {
gap={theme.gap.large}
>
<Stack direction="row" gap={theme.gap.xs}>
<Stack
width={theme.gap.large}
height={theme.gap.large}
alignItems="center"
justifyContent="center"
>
<Box
width="14px"
height="14px"
sx={{
position: "relative",
backgroundColor: monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
}}
/>
</Stack>
<PulseDot
color={
monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor
}
/>
<Box>
<Typography
component="h1"
+8 -27
View File
@@ -19,6 +19,7 @@ import ClockIcon from "../../../assets/icons/maintenance.svg?react";
import IntervalCheckIcon from "../../../assets/icons/interval-check.svg?react";
import PageSpeedLineChart from "../../../Components/Charts/PagespeedLineChart";
import Breadcrumbs from "../../../Components/Breadcrumbs";
import PulseDot from "../../../Components/Animated/PulseDot";
import "./index.css";
const StatBox = ({ icon, title, value }) => {
@@ -324,33 +325,13 @@ const PageSpeedDetails = () => {
]}
/>
<Stack direction="row" gap={theme.gap.xs}>
<Stack
width={theme.gap.large}
height={theme.gap.large}
alignItems="center"
justifyContent="center"
>
<Box
width="14px"
height="14px"
sx={{
position: "relative",
backgroundColor: monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor,
borderRadius: "50%",
"&::before": {
content: `""`,
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: "inherit",
borderRadius: "50%",
animation: "ripple 1.8s ease-out infinite",
},
}}
/>
</Stack>
<PulseDot
color={
monitor?.status
? theme.label.up.dotColor
: theme.label.down.dotColor
}
/>
<Box>
<Typography
component="h1"