bb-plane-fork/web/core/components/gantt-chart/root.tsx
Akshita Goyal 91693b2269
chore: seperated project components for CE (#5324)
* chore: seperated project components for CE

* chore: splitted the code for project creation form

* fix: code structure optimization

* fix: project page root moved

* fix: synced with preview

* fix: component splitting and refactoring

* fix: build error
2024-08-12 18:24:42 +05:30

80 lines
2.5 KiB
TypeScript

import { FC } from "react";
// components
import { ChartDataType, ChartViewRoot, IBlockUpdateData, IGanttBlock } from "@/components/gantt-chart";
// context
import { GanttStoreProvider } from "@/components/gantt-chart/contexts";
type GanttChartRootProps = {
border?: boolean;
title: string;
loaderTitle: string;
blockIds: string[];
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
blockToRender: (data: any) => React.ReactNode;
sidebarToRender: (props: any) => React.ReactNode;
quickAdd?: React.JSX.Element | undefined;
getBlockById: (id: string, currentViewData?: ChartDataType | undefined) => IGanttBlock;
canLoadMoreBlocks?: boolean;
loadMoreBlocks?: () => void;
enableBlockLeftResize?: boolean | ((blockId: string) => boolean);
enableBlockRightResize?: boolean | ((blockId: string) => boolean);
enableBlockMove?: boolean | ((blockId: string) => boolean);
enableReorder?: boolean | ((blockId: string) => boolean);
enableAddBlock?: boolean | ((blockId: string) => boolean);
enableSelection?: boolean | ((blockId: string) => boolean);
bottomSpacing?: boolean;
showAllBlocks?: boolean;
showToday?: boolean;
};
export const GanttChartRoot: FC<GanttChartRootProps> = (props) => {
const {
border = true,
title,
blockIds,
loaderTitle = "blocks",
blockUpdateHandler,
sidebarToRender,
blockToRender,
getBlockById,
loadMoreBlocks,
canLoadMoreBlocks,
enableBlockLeftResize = false,
enableBlockRightResize = false,
enableBlockMove = false,
enableReorder = false,
enableAddBlock = false,
enableSelection = false,
bottomSpacing = false,
showAllBlocks = false,
showToday = true,
quickAdd,
} = props;
return (
<GanttStoreProvider>
<ChartViewRoot
border={border}
title={title}
blockIds={blockIds}
getBlockById={getBlockById}
loadMoreBlocks={loadMoreBlocks}
canLoadMoreBlocks={canLoadMoreBlocks}
loaderTitle={loaderTitle}
blockUpdateHandler={blockUpdateHandler}
sidebarToRender={sidebarToRender}
blockToRender={blockToRender}
enableBlockLeftResize={enableBlockLeftResize}
enableBlockRightResize={enableBlockRightResize}
enableBlockMove={enableBlockMove}
enableReorder={enableReorder}
enableAddBlock={enableAddBlock}
enableSelection={enableSelection}
bottomSpacing={bottomSpacing}
showAllBlocks={showAllBlocks}
quickAdd={quickAdd}
showToday={showToday}
/>
</GanttStoreProvider>
);
};