import { useState, Fragment } from "react"; import { Dialog, Transition } from "@headlessui/react"; // hooks import { useProject } from "hooks/store"; import { useIssues } from "hooks/store/use-issues"; // ui import { Button, TOAST_TYPE, setToast } from "@plane/ui"; // types import { TIssue } from "@plane/types"; type Props = { data?: TIssue; dataId?: string | null | undefined; handleClose: () => void; isOpen: boolean; onSubmit?: () => Promise; }; export const ArchiveIssueModal: React.FC = (props) => { const { dataId, data, isOpen, handleClose, onSubmit } = props; // states const [isArchiving, setIsArchiving] = useState(false); // store hooks const { getProjectById } = useProject(); const { issueMap } = useIssues(); if (!dataId && !data) return null; const issue = data ? data : issueMap[dataId!]; const projectDetails = getProjectById(issue.project_id); const onClose = () => { setIsArchiving(false); handleClose(); }; const handleArchiveIssue = async () => { if (!onSubmit) return; setIsArchiving(true); await onSubmit() .then(() => onClose()) .catch(() => setToast({ type: TOAST_TYPE.ERROR, title: "Error!", message: "Issue could not be archived. Please try again.", }) ) .finally(() => setIsArchiving(false)); }; return (

Archive issue {projectDetails?.identifier} {issue.sequence_id}

Are you sure you want to archive the issue? All your archived issues can be restored later.

); };