import DataTable from "@/Components/v1/Table/index.jsx"; import { useTheme } from "@emotion/react"; import { useNavigate } from "react-router-dom"; import { StatusLabel } from "@/Components/v1/Label/index.jsx"; import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward"; import { Stack, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; const StatusPagesTable = ({ data }) => { const theme = useTheme(); const { t } = useTranslation(); const navigate = useNavigate(); const headers = [ { id: "name", content: t("statusPageName"), render: (row) => { return row.companyName; }, }, { id: "url", content: t("publicURL"), onClick: (e, row) => { if (row.isPublished) { e.stopPropagation(); const url = `/status/uptime/public/${row.url}`; window.open(url, "_blank", "noopener,noreferrer"); } }, render: (row) => { const content = row.isPublished ? `/${row.url}` : "Unpublished"; return ( {content} {row.isPublished && } ); }, }, { id: "type", content: t("type"), render: (row) => { return row.type; }, }, { id: "status", content: t("status"), render: (row) => { const status = row.isPublished ? "published" : "unpublished"; return ( ); }, }, ]; const handleRowClick = (statusPage) => { navigate(`/status/uptime/${statusPage.url}`); }; return ( { handleRowClick(row); }, }} headers={headers} data={data} /> ); }; export default StatusPagesTable;