import { useEffect, useState, Fragment } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { Dialog, Transition } from "@headlessui/react"; import { AlertTriangle } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // ui import { Button } from "@plane/ui"; // types import type { IIssue } from "types"; type Props = { isOpen: boolean; handleClose: () => void; data: IIssue; onSubmit?: () => Promise; }; export const DeleteIssueModal: React.FC = observer((props) => { const { data, isOpen, handleClose, onSubmit } = props; const router = useRouter(); const { workspaceSlug } = router.query; const { issueDetail: issueDetailStore } = useMobxStore(); const [isDeleteLoading, setIsDeleteLoading] = useState(false); useEffect(() => { setIsDeleteLoading(false); }, [isOpen]); const onClose = () => { setIsDeleteLoading(false); handleClose(); }; const handleIssueDelete = async () => { if (!workspaceSlug) return; setIsDeleteLoading(true); await issueDetailStore.deleteIssue(workspaceSlug.toString(), data.project, data.id); if (onSubmit) await onSubmit().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.

); });