use new hooks

This commit is contained in:
Alex Holliday committed 2025-03-14 12:05:26 -07:00
1 parent 7ba1232198
commit e90e497fef
2 files changed
+26 -13

No files matched your search

@@ -19,9 +19,8 @@ import { buildErrors } from "../../../Validation/error";
import { createToast } from "../../../Utils/toastUtils"; import { createToast } from "../../../Utils/toastUtils";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useMonitorsFetch } from "../../StatusPage/Create/Hooks/useMonitorsFetch"; import { useMonitorsFetch } from "../../StatusPage/Create/Hooks/useMonitorsFetch";
import { useDUStatusPageFetchByUrl } from "../Status/Hooks/useDUStatusPageFetchByUrl";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFetchDepinStatusPage } from "../../../Hooks/useFetchDepinStatusPage";
const CreateStatus = () => { const CreateStatus = () => {
const theme = useTheme(); const theme = useTheme();
const { monitorId, url } = useParams(); const { monitorId, url } = useParams();
@@ -32,7 +31,7 @@ const CreateStatus = () => {
const [createStatusPage, isLoading, networkError] = useCreateStatusPage(isCreate); const [createStatusPage, isLoading, networkError] = useCreateStatusPage(isCreate);
const [statusPageIsLoading, statusPageNetworkError, statusPage, _, isPublished] = const [statusPageIsLoading, statusPageNetworkError, statusPage, _, isPublished] =
useDUStatusPageFetchByUrl({ useFetchDepinStatusPage({
url, url,
timeFrame: 30, timeFrame: 30,
isCreate, isCreate,
@@ -178,7 +177,9 @@ const CreateStatus = () => {
component="span" component="span"
fontSize="inherit" fontSize="inherit"
> >
{isCreate ? t("distributedUptimeStatusCreateYour") : t("distributedUptimeStatusEditYour")}{" "} {isCreate
? t("distributedUptimeStatusCreateYour")
: t("distributedUptimeStatusEditYour")}{" "}
</Typography> </Typography>
<Typography <Typography
component="span" component="span"
@@ -191,7 +192,9 @@ const CreateStatus = () => {
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Stack> <Stack>
<Typography component="h2">{t("distributedUptimeStatusCreateStatusPageAccess")}</Typography> <Typography component="h2">
{t("distributedUptimeStatusCreateStatusPageAccess")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeStatusCreateStatusPageReady")} {t("distributedUptimeStatusCreateStatusPageReady")}
</Typography> </Typography>
@@ -208,7 +211,9 @@ const CreateStatus = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("distributedUptimeStatusBasicInfoHeader")}</Typography> <Typography component="h2">
{t("distributedUptimeStatusBasicInfoHeader")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeStatusBasicInfoDescription")} {t("distributedUptimeStatusBasicInfoDescription")}
</Typography> </Typography>
@@ -241,7 +246,9 @@ const CreateStatus = () => {
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2">{t("distributedUptimeStatusLogoHeader")}</Typography> <Typography component="h2">{t("distributedUptimeStatusLogoHeader")}</Typography>
<Typography component="p">{t("distributedUptimeStatusLogoDescription")} </Typography> <Typography component="p">
{t("distributedUptimeStatusLogoDescription")}{" "}
</Typography>
</Stack> </Stack>
<Stack <Stack
gap={theme.spacing(18)} gap={theme.spacing(18)}
@@ -272,7 +279,9 @@ const CreateStatus = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack> <Stack>
<Typography component="h2">{t("distributedUptimeStatusStandardMonitorsHeader")}</Typography> <Typography component="h2">
{t("distributedUptimeStatusStandardMonitorsHeader")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeStatusStandardMonitorsDescription")} {t("distributedUptimeStatusStandardMonitorsDescription")}
</Typography> </Typography>
@@ -23,8 +23,8 @@ import { RowContainer } from "../../../Components/StandardContainer";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { useState, useEffect, useRef } from "react"; import { useState, useEffect, useRef } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useSubscribeToDetails } from "../../DistributedUptime/Details/Hooks/useSubscribeToDetails"; import { useFetchDepinStatusPage } from "../../../Hooks/useFetchDepinStatusPage";
import { useDUStatusPageFetchByUrl } from "./Hooks/useDUStatusPageFetchByUrl"; import { useSubscribeToDepinDetails } from "../../../Hooks/useSubscribeToDepinDetails";
import { useStatusPageDelete } from "../../StatusPage/Status/Hooks/useStatusPageDelete"; import { useStatusPageDelete } from "../../StatusPage/Status/Hooks/useStatusPageDelete";
import TimeFrameHeader from "./Components/TimeframeHeader"; import TimeFrameHeader from "./Components/TimeframeHeader";
import SubHeader from "../../../Components/Subheader"; import SubHeader from "../../../Components/Subheader";
@@ -64,13 +64,13 @@ const DistributedUptimeStatus = () => {
statusPage, statusPage,
monitorId, monitorId,
isPublished, isPublished,
] = useDUStatusPageFetchByUrl({ ] = useFetchDepinStatusPage({
url, url,
timeFrame, timeFrame,
}); });
const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] = const [isLoading, networkError, connectionStatus, monitor, lastUpdateTrigger] =
useSubscribeToDetails({ monitorId, dateRange, isPublic, isPublished }); useSubscribeToDepinDetails({ monitorId, dateRange, isPublic, isPublished });
const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => { const [deleteStatusPage, isDeleting] = useStatusPageDelete(() => {
navigate("/distributed-uptime"); navigate("/distributed-uptime");
@@ -253,7 +253,11 @@ const DistributedUptimeStatus = () => {
sx={{ width: "50%" }} sx={{ width: "50%" }}
/> />
<InfoBox <InfoBox
heading={isSmallScreen ? t("distributedUptimeStatusUpt") : t("distributedUptimeStatusUptBurned")} heading={
isSmallScreen
? t("distributedUptimeStatusUpt")
: t("distributedUptimeStatusUptBurned")
}
subHeading={safelyParseFloat(monitor?.uptBurnt).toFixed(4)} subHeading={safelyParseFloat(monitor?.uptBurnt).toFixed(4)}
img={UptLogo} img={UptLogo}
alt={t("distributedUptimeStatusUptLogo")} alt={t("distributedUptimeStatusUptLogo")}