2025-01-28 11:04:11 -08:00
|
|
|
import { Stack, Button } from "@mui/material";
|
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
|
import PropTypes from "prop-types";
|
|
|
|
|
import SkeletonLayout from "./skeleton";
|
|
|
|
|
|
2025-01-30 14:23:05 -08:00
|
|
|
const CreateMonitorHeader = ({ isAdmin, shouldRender = true, path }) => {
|
2025-01-28 11:04:11 -08:00
|
|
|
const navigate = useNavigate();
|
|
|
|
|
if (!isAdmin) return null;
|
|
|
|
|
if (!shouldRender) return <SkeletonLayout />;
|
|
|
|
|
return (
|
|
|
|
|
<Stack
|
|
|
|
|
direction="row"
|
|
|
|
|
justifyContent="end"
|
|
|
|
|
alignItems="center"
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
variant="contained"
|
|
|
|
|
color="accent"
|
|
|
|
|
onClick={() => navigate(path)}
|
|
|
|
|
>
|
|
|
|
|
Create new
|
|
|
|
|
</Button>
|
|
|
|
|
</Stack>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default CreateMonitorHeader;
|
|
|
|
|
|
|
|
|
|
CreateMonitorHeader.propTypes = {
|
|
|
|
|
isAdmin: PropTypes.bool.isRequired,
|
2025-01-31 07:09:22 -08:00
|
|
|
shouldRender: PropTypes.bool,
|
2025-01-28 11:04:11 -08:00
|
|
|
path: PropTypes.string.isRequired,
|
|
|
|
|
};
|