mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 18:26:40 +00:00
add delete confirm modal to resources and sites
This commit is contained in:
58
src/app/[orgId]/settings/general/page.tsx
Normal file
58
src/app/[orgId]/settings/general/page.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog";
|
||||
import { Button } from "@app/components/ui/button";
|
||||
import { useOrgContext } from "@app/hooks/useOrgContext";
|
||||
import { userOrgUserContext } from "@app/hooks/useOrgUserContext";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function GeneralPage() {
|
||||
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||
|
||||
const { orgUser } = userOrgUserContext();
|
||||
const { org } = useOrgContext();
|
||||
|
||||
async function deleteOrg() {
|
||||
console.log("not implemented");
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ConfirmDeleteDialog
|
||||
open={isDeleteModalOpen}
|
||||
setOpen={(val) => {
|
||||
setIsDeleteModalOpen(val);
|
||||
}}
|
||||
dialog={
|
||||
<div>
|
||||
<p className="mb-2">
|
||||
Are you sure you want to delete the organization{" "}
|
||||
<b>{org?.org.name}?</b>
|
||||
</p>
|
||||
|
||||
<p className="mb-2">
|
||||
This action is irreversible and will delete all
|
||||
associated data.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To confirm, type the name of the organization below.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
buttonText="Confirm delete organization"
|
||||
onConfirm={deleteOrg}
|
||||
string={org?.org.name || ""}
|
||||
title="Delete organization"
|
||||
/>
|
||||
|
||||
{orgUser.isOwner ? (
|
||||
<Button onClick={() => setIsDeleteModalOpen(true)}>
|
||||
Delete Organization
|
||||
</Button>
|
||||
) : (
|
||||
<p>Nothing to see here</p>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user