hide unused features
This commit is contained in:
1 parent
4c284493ba
commit
e3921beac4
3 files changed
+35
-47
No files matched your search
@@ -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>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user