mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import { FC } from "react";
|
|
// components
|
|
import { HEADER_HEIGHT } from "../constants";
|
|
import { ChartDataType, IBlockUpdateData, IGanttBlock } from "../types";
|
|
import { GanttChartBlock } from "./block";
|
|
// types
|
|
// constants
|
|
|
|
export type GanttChartBlocksProps = {
|
|
itemsContainerWidth: number;
|
|
blockIds: string[];
|
|
getBlockById: (id: string, currentViewData?: ChartDataType | undefined) => IGanttBlock;
|
|
blockToRender: (data: any) => React.ReactNode;
|
|
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
|
|
enableBlockLeftResize: boolean;
|
|
enableBlockRightResize: boolean;
|
|
enableBlockMove: boolean;
|
|
enableAddBlock: boolean;
|
|
ganttContainerRef: React.RefObject<HTMLDivElement>;
|
|
showAllBlocks: boolean;
|
|
};
|
|
|
|
export const GanttChartBlocksList: FC<GanttChartBlocksProps> = (props) => {
|
|
const {
|
|
itemsContainerWidth,
|
|
blockIds,
|
|
blockToRender,
|
|
blockUpdateHandler,
|
|
getBlockById,
|
|
enableBlockLeftResize,
|
|
enableBlockRightResize,
|
|
enableBlockMove,
|
|
enableAddBlock,
|
|
ganttContainerRef,
|
|
showAllBlocks,
|
|
} = props;
|
|
|
|
return (
|
|
<div
|
|
className="h-full"
|
|
style={{
|
|
width: `${itemsContainerWidth}px`,
|
|
transform: `translateY(${HEADER_HEIGHT}px)`,
|
|
}}
|
|
>
|
|
{blockIds?.map((blockId) => {
|
|
return (
|
|
<GanttChartBlock
|
|
key={blockId}
|
|
blockId={blockId}
|
|
getBlockById={getBlockById}
|
|
showAllBlocks={showAllBlocks}
|
|
blockToRender={blockToRender}
|
|
blockUpdateHandler={blockUpdateHandler}
|
|
enableBlockLeftResize={enableBlockLeftResize}
|
|
enableBlockRightResize={enableBlockRightResize}
|
|
enableBlockMove={enableBlockMove}
|
|
enableAddBlock={enableAddBlock}
|
|
ganttContainerRef={ganttContainerRef}
|
|
/>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
};
|