"use client"; import { useState, Fragment } from "react"; import { Dialog, Transition } from "@headlessui/react"; import { TIssue } from "@plane/types"; // hooks import { Button, TOAST_TYPE, setToast } from "@plane/ui"; import { useProject } from "@/hooks/store"; import { useIssues } from "@/hooks/store/use-issues"; // ui // 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(() => { setToast({ type: TOAST_TYPE.SUCCESS, title: "Archive success", message: "Your archives can be found in project archives.", }); 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.

); };