import { RefObject } from "react"; import { observer } from "mobx-react"; // components import { MultipleSelectGroupAction } from "@/components/core"; import { ChartDataType, IBlockUpdateData, IGanttBlock } from "@/components/gantt-chart"; // helpers import { cn } from "@/helpers/common.helper"; // hooks import { TSelectionHelper } from "@/hooks/use-multiple-select"; // constants import { GANTT_SELECT_GROUP, HEADER_HEIGHT, SIDEBAR_WIDTH } from "../constants"; type Props = { blockIds: string[]; blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void; canLoadMoreBlocks?: boolean; loadMoreBlocks?: () => void; ganttContainerRef: RefObject; enableReorder: boolean; enableSelection: boolean; sidebarToRender: (props: any) => React.ReactNode; title: string; getBlockById: (id: string, currentViewData?: ChartDataType | undefined) => IGanttBlock; quickAdd?: React.JSX.Element | undefined; selectionHelpers: TSelectionHelper; }; export const GanttChartSidebar: React.FC = observer((props) => { const { blockIds, blockUpdateHandler, enableReorder, enableSelection, sidebarToRender, getBlockById, loadMoreBlocks, canLoadMoreBlocks, ganttContainerRef, title, quickAdd, selectionHelpers, } = props; const isGroupSelectionEmpty = selectionHelpers.isGroupSelected(GANTT_SELECT_GROUP) === "empty"; return (
{enableSelection && (
)}
{title}
Duration
{sidebarToRender && sidebarToRender({ title, blockUpdateHandler, blockIds, getBlockById, enableReorder, enableSelection, canLoadMoreBlocks, ganttContainerRef, loadMoreBlocks, selectionHelpers })}
{quickAdd ? quickAdd : null}
); });