import { MutableRefObject } from "react"; // components // ui import { Loader } from "@plane/ui"; // types import { IGanttBlock, IBlockUpdateData } from "@/components/gantt-chart/types"; import { GanttDnDHOC } from "../gantt-dnd-HOC"; import { handleOrderChange } from "../utils"; import { IssuesSidebarBlock } from "./block"; type Props = { blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void; blocks: IGanttBlock[] | null; enableReorder: boolean; showAllBlocks?: boolean; }; export const IssueGanttSidebar: React.FC = (props) => { const { blockUpdateHandler, blocks, enableReorder, showAllBlocks = false } = props; const handleOnDrop = ( draggingBlockId: string | undefined, droppedBlockId: string | undefined, dropAtEndOfList: boolean ) => { handleOrderChange(draggingBlockId, droppedBlockId, dropAtEndOfList, blocks, blockUpdateHandler); }; return (
{blocks ? ( blocks.map((block, index) => { const isBlockVisibleOnSidebar = block.start_date && block.target_date; // hide the block if it doesn't have start and target dates and showAllBlocks is false if (!showAllBlocks && !isBlockVisibleOnSidebar) return; return ( {(isDragging: boolean, dragHandleRef: MutableRefObject) => ( )} ); }) ) : ( )}
); };