import { useState } from "react"; import { useRouter } from "next/router"; import { CustomMenu } from "@plane/ui"; import { Link, Trash2 } from "lucide-react"; // hooks import useToast from "hooks/use-toast"; import { useEventTracker, useIssues, useUser } from "hooks/store"; // components import { DeleteArchivedIssueModal } from "components/issues"; // helpers import { copyUrlToClipboard } from "helpers/string.helper"; // types import { IQuickActionProps } from "../list/list-view-types"; import { EUserProjectRoles } from "constants/project"; import { EIssuesStoreType } from "constants/issue"; export const ArchivedIssueQuickActions: React.FC = (props) => { const { issue, handleDelete, customActionButton, portalElement, readOnly = false } = props; // router const router = useRouter(); const { workspaceSlug } = router.query; // states const [deleteIssueModal, setDeleteIssueModal] = useState(false); // toast alert const { setToastAlert } = useToast(); // store hooks const { membership: { currentProjectRole }, } = useUser(); const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; // store hooks const { setTrackElement } = useEventTracker(); const { issuesFilter } = useIssues(EIssuesStoreType.ARCHIVED); const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`; const handleCopyIssueLink = () => { copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project_id}/archived-issues/${issue.id}`).then(() => setToastAlert({ type: "success", title: "Link copied", message: "Issue link copied to clipboard", }) ); }; return ( <> setDeleteIssueModal(false)} onSubmit={handleDelete} /> { handleCopyIssueLink(); }} >
Copy link
{isEditingAllowed && !readOnly && ( { setTrackElement(activeLayout); setDeleteIssueModal(true); }} >
Delete issue
)}
); };