import React, { useState } from "react"; import { useRouter } from "next/router"; import { Popover2 } from "@blueprintjs/popover2"; import { MoreHorizontal, Pencil, Trash2, ChevronRight, Link } from "lucide-react"; // hooks import useToast from "hooks/use-toast"; // components import { Tooltip } from "@plane/ui"; // helpers import { copyUrlToClipboard } from "helpers/string.helper"; // types import { IIssue, IIssueDisplayProperties } from "types"; type Props = { issue: IIssue; expanded: boolean; handleToggleExpand: (issueId: string) => void; properties: IIssueDisplayProperties; handleEditIssue: (issue: IIssue) => void; handleDeleteIssue: (issue: IIssue) => void; setIssuePeekOverView: React.Dispatch< React.SetStateAction<{ workspaceSlug: string; projectId: string; issueId: string; } | null> >; disableUserActions: boolean; nestingLevel: number; }; export const IssueColumn: React.FC = ({ issue, expanded, handleToggleExpand, setIssuePeekOverView, properties, handleEditIssue, handleDeleteIssue, disableUserActions, nestingLevel, }) => { const [isOpen, setIsOpen] = useState(false); const router = useRouter(); const { workspaceSlug } = router.query; const { setToastAlert } = useToast(); const handleCopyText = () => { copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", message: "Issue link copied to clipboard.", }); }); }; const handleIssuePeekOverview = (issue: IIssue) => { const { query } = router; setIssuePeekOverView({ workspaceSlug: issue?.workspace_detail?.slug, projectId: issue?.project_detail?.id, issueId: issue?.id, }); router.push({ pathname: router.pathname, query: { ...query, peekIssueId: issue?.id }, }); }; const paddingLeft = `${nestingLevel * 54}px`; return ( <>
{properties.key && (
{issue.project_detail?.identifier}-{issue.sequence_id} {!disableUserActions && (
setIsOpen(nextOpenState)} content={
} placement="bottom-start" >
)}
{issue.sub_issues_count > 0 && (
)}
)}
handleIssuePeekOverview(issue)} > {issue.name}
); };