hide unused features

This commit is contained in:
Alex Holliday committed 2026-02-03 21:53:34 +00:00
1 parent 4c284493ba
commit e3921beac4
3 files changed
+35 -47

No files matched your search

+2 -3
View File
@@ -251,7 +251,6 @@ const CreateStatusPage = () => {
onChange={(_, newValue) => {
field.onChange(newValue.map((m: Monitor) => m.id));
}}
renderTags={() => null}
fieldLabel={t(
"pages.statusPages.form.monitors.option.monitors.label"
)}
@@ -424,7 +423,7 @@ const CreateStatusPage = () => {
/>
)}
/>
<Controller
{/* <Controller
name="showUptimePercentage"
control={control}
render={({ field }) => (
@@ -457,7 +456,7 @@ const CreateStatusPage = () => {
)}
/>
)}
/>
/> */}
</Stack>
}
/>
@@ -3,52 +3,26 @@ import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import { Table, type Header, ValueLabel } from "@/Components/v2/design-elements";
import { ActionsMenu, type ActionMenuItem } from "@/Components/v2/actions-menu";
import { Dialog } from "@/Components/v2/inputs";
import { ExternalLink } from "lucide-react";
import { useTranslation } from "react-i18next";
import { useTheme } from "@mui/material/styles";
import { useNavigate } from "react-router-dom";
import { useDelete } from "@/Hooks/UseApi";
import { useState } from "react";
import { createToast } from "@/Utils/toastUtils";
import type { StatusPage } from "@/Types/StatusPage";
interface StatusPagesTableProps {
data: StatusPage[];
refetch: () => void;
setSelectedStatusPage: (statusPage: StatusPage | null) => void;
}
export const StatusPagesTable = ({ data, refetch }: StatusPagesTableProps) => {
export const StatusPagesTable = ({
data,
setSelectedStatusPage,
}: StatusPagesTableProps) => {
const { t } = useTranslation();
const theme = useTheme();
const navigate = useNavigate();
const { deleteFn, loading: isDeleting } = useDelete();
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const [selectedStatusPage, setSelectedStatusPage] = useState<StatusPage | null>(null);
const handleDeleteClick = (statusPage: StatusPage) => {
setSelectedStatusPage(statusPage);
setIsDeleteDialogOpen(true);
};
const handleDeleteConfirm = async () => {
if (!selectedStatusPage) return;
const result = await deleteFn(`/status-page/${selectedStatusPage.id}`);
if (result) {
createToast({ body: t("pages.statusPages.deleteSuccess") });
refetch();
}
setIsDeleteDialogOpen(false);
setSelectedStatusPage(null);
};
const handleDeleteCancel = () => {
setIsDeleteDialogOpen(false);
setSelectedStatusPage(null);
};
const getActions = (row: StatusPage): ActionMenuItem[] => {
return [
@@ -67,9 +41,7 @@ export const StatusPagesTable = ({ data, refetch }: StatusPagesTableProps) => {
{t("common.buttons.delete")}
</Typography>
),
action: () => {
handleDeleteClick(row);
},
action: () => setSelectedStatusPage(row),
closeMenu: true,
},
];
@@ -165,14 +137,6 @@ export const StatusPagesTable = ({ data, refetch }: StatusPagesTableProps) => {
onRowClick={handleRowClick}
emptyViewText={t("common.table.empty")}
/>
<Dialog
open={isDeleteDialogOpen}
title={t("common.dialogs.delete.title")}
content={t("common.dialogs.delete.description")}
onConfirm={handleDeleteConfirm}
onCancel={handleDeleteCancel}
loading={isDeleting}
/>
</Box>
);
};
@@ -1,6 +1,8 @@
import { useState } from "react";
import { BasePageWithStates } from "@/Components/v2/design-elements";
import { Dialog } from "@/Components/v2/inputs";
import { StatusPagesTable } from "./Components/StatusPagesTable";
import { useGet } from "@/Hooks/UseApi";
import { useGet, useDelete } from "@/Hooks/UseApi";
import type { StatusPage } from "@/Types/StatusPage";
import { useTranslation } from "react-i18next";
import { HeaderCreate } from "@/Components/v2/common";
@@ -16,8 +18,23 @@ const StatusPages = () => {
refetch,
} = useGet<StatusPage[]>("/status-page/team");
const { deleteFn, loading: isDeleting } = useDelete();
const [selectedStatusPage, setSelectedStatusPage] = useState<StatusPage | null>(null);
const isDialogOpen = Boolean(selectedStatusPage);
const isAdmin = useIsAdmin();
const handleConfirm = async () => {
if (!selectedStatusPage) return;
await deleteFn(`/status-page/${selectedStatusPage.id}`);
setSelectedStatusPage(null);
refetch();
};
const handleCancel = () => {
setSelectedStatusPage(null);
};
return (
<BasePageWithStates
page={t("pages.statusPages.title")}
@@ -36,7 +53,15 @@ const StatusPages = () => {
/>
<StatusPagesTable
data={statusPages ?? []}
refetch={refetch}
setSelectedStatusPage={setSelectedStatusPage}
/>
<Dialog
open={isDialogOpen}
title={t("common.dialogs.delete.title")}
content={t("common.dialogs.delete.description")}
onConfirm={handleConfirm}
onCancel={handleCancel}
loading={isDeleting}
/>
</BasePageWithStates>
);