// Components import { Box, Stack, Typography, Button } from "@mui/material"; import Image from "../../../../../Components/Image"; import SettingsIcon from "../../../../../assets/icons/settings-bold.svg?react"; import ThemeSwitch from "../../../../../Components/ThemeSwitch"; import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward"; //Utils import { useTheme } from "@mui/material/styles"; import { useNavigate } from "react-router-dom"; import { useLocation } from "react-router-dom"; import PropTypes from "prop-types"; import { useTranslation } from "react-i18next"; const Controls = ({ isDeleteOpen, setIsDeleteOpen, isDeleting, url, type }) => { const theme = useTheme(); const { t } = useTranslation(); const location = useLocation(); const currentPath = location.pathname; const navigate = useNavigate(); if (currentPath.startsWith("/status/uptime/public")) { return null; } if (currentPath.startsWith("/status/distributed/public")) { return null; } return ( ); }; Controls.propTypes = { type: PropTypes.string, isDeleting: PropTypes.bool, url: PropTypes.string, isDeleteOpen: PropTypes.bool.isRequired, setIsDeleteOpen: PropTypes.func.isRequired, }; const ControlsHeader = ({ statusPage, isPublic, isDeleting, isDeleteOpen, setIsDeleteOpen, url, type = "uptime", }) => { const theme = useTheme(); const { t } = useTranslation(); const publicUrl = type === "uptime" ? `/status/uptime/public/${url}` : `/status/distributed/public/${url}`; return ( {"Company {statusPage?.companyName} {statusPage?.isPublished && !isPublic && ( { window.open(publicUrl, "_blank", "noopener,noreferrer"); }} sx={{ display: "inline-flex", ":hover": { cursor: "pointer", borderBottom: 1, }, }} > {t("publicLink")} )} {isPublic && } ); }; ControlsHeader.propTypes = { url: PropTypes.string, statusPage: PropTypes.object, isPublic: PropTypes.bool, isDeleting: PropTypes.bool, isDeleteOpen: PropTypes.bool.isRequired, setIsDeleteOpen: PropTypes.func.isRequired, type: PropTypes.string, }; export default ControlsHeader;