2024-06-10 08:06:10 +00:00
|
|
|
"use client";
|
|
|
|
|
2023-10-18 13:47:02 +00:00
|
|
|
import React from "react";
|
2024-03-21 15:29:34 +00:00
|
|
|
import { ChevronRight, ChevronUp } from "lucide-react";
|
2024-03-19 14:38:35 +00:00
|
|
|
import { Disclosure, Transition } from "@headlessui/react";
|
2024-03-21 15:29:34 +00:00
|
|
|
// types
|
2024-03-19 14:38:35 +00:00
|
|
|
import { IProject } from "@plane/types";
|
2024-03-21 15:29:34 +00:00
|
|
|
// ui
|
2023-10-18 13:47:02 +00:00
|
|
|
import { Button, Loader } from "@plane/ui";
|
|
|
|
|
|
|
|
export interface IDeleteProjectSection {
|
|
|
|
projectDetails: IProject;
|
|
|
|
handleDelete: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const DeleteProjectSection: React.FC<IDeleteProjectSection> = (props) => {
|
|
|
|
const { projectDetails, handleDelete } = props;
|
2023-10-31 06:36:55 +00:00
|
|
|
|
2023-10-18 13:47:02 +00:00
|
|
|
return (
|
2024-03-21 15:29:34 +00:00
|
|
|
<Disclosure as="div" className="border-t border-custom-border-100 py-4">
|
2023-10-18 13:47:02 +00:00
|
|
|
{({ open }) => (
|
|
|
|
<div className="w-full">
|
2024-03-21 15:29:34 +00:00
|
|
|
<Disclosure.Button as="button" type="button" className="flex w-full items-center justify-between">
|
2023-10-18 13:47:02 +00:00
|
|
|
<span className="text-xl tracking-tight">Delete Project</span>
|
2024-03-21 15:29:34 +00:00
|
|
|
{open ? <ChevronUp className="h-5 w-5" /> : <ChevronRight className="h-5 w-5" />}
|
2023-10-18 13:47:02 +00:00
|
|
|
</Disclosure.Button>
|
|
|
|
|
|
|
|
<Transition
|
|
|
|
show={open}
|
|
|
|
enter="transition duration-100 ease-out"
|
|
|
|
enterFrom="transform opacity-0"
|
|
|
|
enterTo="transform opacity-100"
|
|
|
|
leave="transition duration-75 ease-out"
|
|
|
|
leaveFrom="transform opacity-100"
|
|
|
|
leaveTo="transform opacity-0"
|
|
|
|
>
|
|
|
|
<Disclosure.Panel>
|
2024-03-21 15:29:34 +00:00
|
|
|
<div className="flex flex-col gap-8 pt-4">
|
2023-10-18 13:47:02 +00:00
|
|
|
<span className="text-sm tracking-tight">
|
|
|
|
The danger zone of the project delete page is a critical area that requires careful consideration and
|
|
|
|
attention. When deleting a project, all of the data and resources within that project will be
|
|
|
|
permanently removed and cannot be recovered.
|
|
|
|
</span>
|
|
|
|
<div>
|
|
|
|
{projectDetails ? (
|
|
|
|
<div>
|
|
|
|
<Button variant="danger" onClick={handleDelete}>
|
|
|
|
Delete my project
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<Loader className="mt-2 w-full">
|
|
|
|
<Loader.Item height="38px" width="144px" />
|
|
|
|
</Loader>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Disclosure.Panel>
|
|
|
|
</Transition>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</Disclosure>
|
|
|
|
);
|
|
|
|
};
|