import { DraggableProvided, DraggableStateSnapshot } from "@hello-pangea/dnd"; import { observer } from "mobx-react"; import { MoreVertical } from "lucide-react"; // hooks import { useIssueDetail } from "hooks/store"; 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"; // types import { IGanttBlock } from "../../types"; // constants import { BLOCK_HEIGHT } from "../../constants"; type Props = { block: IGanttBlock; enableReorder: boolean; provided: DraggableProvided; snapshot: DraggableStateSnapshot; }; export const IssuesSidebarBlock: React.FC = observer((props) => { const { block, enableReorder, provided, snapshot } = props; // store hooks const { updateActiveBlockId, isBlockActive } = useGanttChart(); const { peekIssue } = useIssueDetail(); const duration = findTotalDaysInRange(block.start_date, block.target_date); return (
updateActiveBlockId(block.id)} onMouseLeave={() => updateActiveBlockId(null)} ref={provided.innerRef} {...provided.draggableProps} >
{enableReorder && ( )}
{duration && (
{duration} day{duration > 1 ? "s" : ""}
)}
); });