import React, { useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; import { Dialog, Transition } from "@headlessui/react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // hooks import useToast from "hooks/use-toast"; // icons import { AlertTriangle } from "lucide-react"; // ui import { Button } from "@plane/ui"; // types import type { IInboxIssue } from "types"; type Props = { data: IInboxIssue; isOpen: boolean; onClose: () => void; }; export const DeleteInboxIssueModal: React.FC = observer(({ isOpen, onClose, data }) => { const [isDeleting, setIsDeleting] = useState(false); const router = useRouter(); const { workspaceSlug, projectId, inboxId } = router.query; const { inboxIssueDetails: inboxIssueDetailsStore } = useMobxStore(); const { setToastAlert } = useToast(); const handleClose = () => { setIsDeleting(false); onClose(); }; const handleDelete = () => { if (!workspaceSlug || !projectId || !inboxId) return; setIsDeleting(true); inboxIssueDetailsStore .deleteIssue(workspaceSlug.toString(), projectId.toString(), inboxId.toString(), data.issue_inbox[0].id) .then(() => { setToastAlert({ type: "success", title: "Success!", message: "Issue deleted successfully.", }); // remove inboxIssueId from the url router.push({ pathname: `/${workspaceSlug}/projects/${projectId}/inbox/${inboxId}`, }); handleClose(); }) .catch(() => setToastAlert({ type: "error", title: "Error!", message: "Issue could not be deleted. Please try again.", }) ) .finally(() => setIsDeleting(false)); }; return (

Delete Issue

Are you sure you want to delete issue{" "} {data?.project_detail?.identifier}-{data?.sequence_id} {""}? The issue will only be deleted from the inbox and this action cannot be undone.

); });