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