Files
Checkmate/Client/src/Pages/Uptime/Home/fallback.jsx
T

59 lines
1.5 KiB
React
Raw Normal View History

2024-09-17 20:26:52 -04:00
import { Box, Button, Stack, Typography } from "@mui/material";
2024-08-27 15:18:18 -07:00
import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
2024-09-17 20:26:52 -04:00
import { useSelector } from "react-redux";
import PlaceholderLight from "../../../assets/Images/data_placeholder.svg?react";
import PlaceholderDark from "../../../assets/Images/data_placeholder_dark.svg?react";
2024-08-27 15:18:18 -07:00
import PropTypes from "prop-types";
const Fallback = ({ isAdmin }) => {
const theme = useTheme();
const navigate = useNavigate();
const mode = useSelector((state) => state.ui.mode);
2024-08-27 15:18:18 -07:00
return (
<Stack
alignItems="center"
backgroundColor={theme.palette.background.main}
p={theme.spacing(30)}
pt={theme.spacing(25)}
gap={theme.spacing(2)}
border={1}
borderRadius={theme.shape.borderRadius}
borderColor={theme.palette.border.light}
color={theme.palette.text.secondary}
>
<Box pb={theme.spacing(20)}>
{mode === "light" ? <PlaceholderLight /> : <PlaceholderDark />}
</Box>
<Typography
component="h2"
variant="h2"
fontWeight={500}
>
No monitors found to display
</Typography>
<Typography variant="body1">
It looks like you don’t have any monitors set up yet.
</Typography>
{isAdmin && (
<Button
variant="contained"
color="primary"
onClick={() => {
navigate("/monitors/create");
}}
sx={{ mt: theme.spacing(12) }}
>
Create your first monitor
</Button>
)}
</Stack>
);
2024-08-27 15:18:18 -07:00
};
Fallback.propTypes = {
isAdmin: PropTypes.bool,
2024-08-27 15:18:18 -07:00
};
export default Fallback;