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 { TIssue, IIssueDisplayProperties } from "@plane/types"; import { useProject } from "hooks/store"; type Props = { issue: TIssue; expanded: boolean; handleToggleExpand: (issueId: string) => void; properties: IIssueDisplayProperties; quickActions: (issue: TIssue, 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(); // hooks const { getProjectById } = useProject(); // states const [isMenuActive, setIsMenuActive] = useState(false); const menuActionRef = useRef(null); const handleIssuePeekOverview = (issue: TIssue) => { const { query } = router; router.push({ pathname: router.pathname, query: { ...query, peekIssueId: issue?.id, peekProjectId: issue?.project_id }, }); }; const paddingLeft = `${nestingLevel * 54}px`; useOutsideClickDetector(menuActionRef, () => setIsMenuActive(false)); const customActionButton = (
setIsMenuActive(!isMenuActive)} >
); return ( <>
{properties.key && (
{getProjectById(issue.project_id)?.identifier}-{issue.sequence_id} {canEditProperties(issue.project_id) && ( )}
{issue.sub_issues_count > 0 && (
)}
)}
handleIssuePeekOverview(issue)} > {issue.name}
); };