replace Greeting component with SubHeader for improved layout and functionality

This commit is contained in:
tunckiral committed 2025-02-22 15:44:05 -05:00
1 parent 0ff7d032a9
commit db0c1ad4a4
3 files changed
+83 -57

No files matched your search

@@ -0,0 +1,71 @@
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { Box, Stack, Typography } from "@mui/material";
import { RowContainer } from "../../../../../Components/StandardContainer";
/**
*
* @component
* @example
*
* @param {Object} props
* @param {string} props.type - The type of monitor to be displayed in the message
* @returns {JSX.Element} The rendered component
*/
const SubHeader = ({ headerText='', subHeaderText='', rightCatagoryTitle='',rightDescription='' }) => {
const theme = useTheme();
return (
<Stack
direction="row"
justifyContent="space-between"
>
<Stack
direction={"column"}
>
<Typography
component="h1"
variant="h1"
mb={theme.spacing(1)}
>
<Typography
component="span"
fontSize="inherit"
color={theme.palette.primary.contrastTextTertiary}
>
{headerText}
</Typography>
</Typography>
<Typography
variant="body2"
lineHeight={1}
color={theme.palette.primary.contrastTextTertiary}
>
{subHeaderText}
</Typography>
</Stack>
{rightCatagoryTitle &&
<RowContainer sx={{ width: "20%" }}>
<Stack>
<Typography variant={`body2`}>{rightCatagoryTitle}</Typography>
<Typography variant={`h2`}>
{rightDescription}
</Typography>
</Stack>
</RowContainer>
}
</Stack>
);
};
SubHeader.propTypes = {
type: PropTypes.string,
};
export default SubHeader;
@@ -1,55 +0,0 @@
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { Box, Typography } from "@mui/material";
import { useDispatch, useSelector } from "react-redux";
import { useEffect } from "react";
import { setGreeting } from "../Features/UI/uiSlice";
/**
*
* @component
* @example
*
* @param {Object} props
* @param {string} props.type - The type of monitor to be displayed in the message
* @returns {JSX.Element} The rendered component
*/
const Greeting = ({ type = "" }) => {
const theme = useTheme();
const dispatch = useDispatch();
return (
<Box>
<Typography
component="h1"
variant="h1"
mb={theme.spacing(1)}
>
<Typography
component="span"
fontSize="inherit"
color={theme.palette.primary.contrastTextTertiary}
>
Real-time, real-device coverage
</Typography>
</Typography>
<Typography
variant="h2"
lineHeight={1}
color={theme.palette.primary.contrastTextTertiary}
>
Powered by millions of devices worldwide, view a system's performance by global region, country or city.
</Typography>
</Box>
);
};
Greeting.propTypes = {
type: PropTypes.string,
};
export default Greeting;
@@ -24,8 +24,10 @@ import { useParams } from "react-router-dom";
import { useSubscribeToDetails } from "../../DistributedUptime/Details/Hooks/useSubscribeToDetails";
import { useStatusPageFetchByUrl } from "./Hooks/useStatusPageFetchByUrl";
import { useStatusPageDelete } from "../../StatusPage/Status/Hooks/useStatusPageDelete";
import { useNavigate } from "react-router-dom";
import { useLocation } from "react-router-dom";
import SubHeader from "../../DistributedUptime/Details/Components/Subheader";
const DistributedUptimeStatus = () => {
const { url } = useParams();
const location = useLocation();
@@ -153,13 +155,21 @@ const DistributedUptimeStatus = () => {
url={url}
type="distributed"
/>
<StatusHeader
monitor={monitor}
connectionStatus={connectionStatus}
elementToCapture={elementToCapture}
/>
<SubHeader
headerText="Real-time, real-device coverage"
subHeaderText="Powered by millions devices worldwide, view a system performance by global region, country or city"
rightCatagoryTitle="Monitor"
rightDescription = "Mainnet Beta Cluster"
/>
<NextExpectedCheck
lastUpdateTime={monitor?.timeSinceLastCheck ?? 0}
interval={monitor?.interval ?? 0}