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();
|
2024-09-17 20:26:52 -04:00
|
|
|
|
const mode = useSelector((state) => state.ui.mode);
|
2024-08-27 15:18:18 -07:00
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Stack
|
|
|
|
|
|
alignItems="center"
|
2024-08-28 14:42:38 -04:00
|
|
|
|
backgroundColor={theme.palette.background.main}
|
|
|
|
|
|
p={theme.spacing(30)}
|
2024-09-17 20:26:52 -04:00
|
|
|
|
pt={theme.spacing(25)}
|
2024-08-28 14:42:38 -04:00
|
|
|
|
gap={theme.spacing(2)}
|
2024-08-27 15:18:18 -07:00
|
|
|
|
border={1}
|
2024-08-28 14:42:38 -04:00
|
|
|
|
borderRadius={theme.shape.borderRadius}
|
|
|
|
|
|
borderColor={theme.palette.border.light}
|
|
|
|
|
|
color={theme.palette.text.secondary}
|
2024-08-27 15:18:18 -07:00
|
|
|
|
>
|
2024-09-17 20:26:52 -04:00
|
|
|
|
<Box pb={theme.spacing(20)}>
|
|
|
|
|
|
{mode === "light" ? <PlaceholderLight /> : <PlaceholderDark />}
|
|
|
|
|
|
</Box>
|
2024-09-14 12:36:20 -04:00
|
|
|
|
<Typography component="h2" variant="h2" fontWeight={500}>
|
2024-09-17 20:26:52 -04:00
|
|
|
|
No monitors found to display
|
2024-09-14 12:36:20 -04:00
|
|
|
|
</Typography>
|
|
|
|
|
|
<Typography variant="body1">
|
2024-08-27 15:18:18 -07:00
|
|
|
|
It looks like you don’t have any monitors set up yet.
|
|
|
|
|
|
</Typography>
|
|
|
|
|
|
{isAdmin && (
|
|
|
|
|
|
<Button
|
2024-08-31 20:00:29 -04:00
|
|
|
|
variant="contained"
|
2024-08-31 17:37:55 -04:00
|
|
|
|
color="primary"
|
2024-08-27 15:18:18 -07:00
|
|
|
|
onClick={() => {
|
|
|
|
|
|
navigate("/monitors/create");
|
|
|
|
|
|
}}
|
2024-08-28 14:42:38 -04:00
|
|
|
|
sx={{ mt: theme.spacing(12) }}
|
2024-08-31 17:37:55 -04:00
|
|
|
|
>
|
|
|
|
|
|
Create your first monitor
|
|
|
|
|
|
</Button>
|
2024-08-27 15:18:18 -07:00
|
|
|
|
)}
|
|
|
|
|
|
</Stack>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Fallback.propTypes = {
|
|
|
|
|
|
isAdmin: PropTypes.bool,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default Fallback;
|