import React, { useRef, useState } from "react"; import { useRouter } from "next/router"; import { ChevronRight, MoreHorizontal } from "lucide-react"; // components import { Tooltip } from "@plane/ui"; // hooks import useOutsideClickDetector from "hooks/use-outside-click-detector"; // types import { IIssue, IIssueDisplayProperties } from "types"; type Props = { issue: IIssue; expanded: boolean; handleToggleExpand: (issueId: string) => void; properties: IIssueDisplayProperties; quickActions: (issue: IIssue, customActionButton?: React.ReactElement) => React.ReactNode; canEditProperties: (projectId: string | undefined) => boolean; nestingLevel: number; }; export const IssueColumn: React.FC = ({ issue, expanded, handleToggleExpand, properties, quickActions, canEditProperties, nestingLevel, }) => { // router const router = useRouter(); // states const [isMenuActive, setIsMenuActive] = useState(false); const menuActionRef = useRef(null); const handleIssuePeekOverview = (issue: IIssue, event: React.MouseEvent) => { const { query } = router; if (event.ctrlKey || event.metaKey) { const issueUrl = `/${issue.workspace_detail.slug}/projects/${issue.project_detail.id}/issues/${issue?.id}`; window.open(issueUrl, "_blank"); // Open link in a new tab } else { router.push({ pathname: router.pathname, query: { ...query, peekIssueId: issue?.id, peekProjectId: issue?.project }, }); } }; const paddingLeft = `${nestingLevel * 54}px`; useOutsideClickDetector(menuActionRef, () => setIsMenuActive(false)); const customActionButton = (
setIsMenuActive(!isMenuActive)} >
); return ( <>
{properties.key && (
{issue.project_detail?.identifier}-{issue.sequence_id} {canEditProperties(issue.project) && ( )}
{issue.sub_issues_count > 0 && (
)}
)}
handleIssuePeekOverview(issue, e)} > {issue.name}
); };