import { useEffect, useState, Fragment } from "react"; import { Dialog, Transition } from "@headlessui/react"; import { AlertTriangle } from "lucide-react"; // ui import { Button } from "@plane/ui"; // hooks import useToast from "hooks/use-toast"; // types import type { IIssue } from "types"; type Props = { isOpen: boolean; handleClose: () => void; data: IIssue; onSubmit?: () => Promise; }; export const DeleteIssueModal: React.FC = (props) => { const { data, isOpen, handleClose, onSubmit } = props; const [isDeleteLoading, setIsDeleteLoading] = useState(false); const { setToastAlert } = useToast(); useEffect(() => { setIsDeleteLoading(false); }, [isOpen]); const onClose = () => { setIsDeleteLoading(false); handleClose(); }; const handleIssueDelete = async () => { setIsDeleteLoading(true); if (onSubmit) await onSubmit() .then(() => { setToastAlert({ title: "Success", type: "success", message: "Issue deleted successfully", }); onClose(); }) .catch(() => { setToastAlert({ title: "Error", type: "error", message: "Failed to delete issue", }); }) .finally(() => setIsDeleteLoading(false)); }; return (

Delete Issue

Are you sure you want to delete issue{" "} {data?.project_detail?.identifier}-{data?.sequence_id} {""}? All of the data related to the issue will be permanently removed. This action cannot be undone.

); };