import React, { MutableRefObject } from "react"; import { observer } from "mobx-react"; import { MoreVertical } from "lucide-react"; // hooks import { useGanttChart } from "@/components/gantt-chart/hooks"; // components import { IssueGanttSidebarBlock } from "@/components/issues"; // helpers import { cn } from "@/helpers/common.helper"; import { findTotalDaysInRange } from "@/helpers/date-time.helper"; import { useIssueDetail } from "@/hooks/store"; // types // constants import { BLOCK_HEIGHT } from "../../constants"; import { IGanttBlock } from "../../types"; type Props = { block: IGanttBlock; enableReorder: boolean; isDragging: boolean; dragHandleRef: MutableRefObject; }; export const IssuesSidebarBlock = observer((props: Props) => { const { block, enableReorder, isDragging, dragHandleRef } = props; // store hooks const { updateActiveBlockId, isBlockActive } = useGanttChart(); const { getIsIssuePeeked } = useIssueDetail(); const duration = findTotalDaysInRange(block.start_date, block.target_date); return (
updateActiveBlockId(block.id)} onMouseLeave={() => updateActiveBlockId(null)} >
{enableReorder && ( )}
{duration && (
{duration} day{duration > 1 ? "s" : ""}
)}
); });