2024-02-12 09:38:17 +00:00
|
|
|
// components
|
|
|
|
import { IBlockUpdateData, IGanttBlock } from "components/gantt-chart";
|
|
|
|
// constants
|
|
|
|
import { HEADER_HEIGHT, SIDEBAR_WIDTH } from "../constants";
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
blocks: IGanttBlock[] | null;
|
|
|
|
blockUpdateHandler: (block: any, payload: IBlockUpdateData) => void;
|
|
|
|
enableReorder: boolean;
|
|
|
|
sidebarToRender: (props: any) => React.ReactNode;
|
|
|
|
title: string;
|
2024-02-14 12:45:13 +00:00
|
|
|
quickAdd?: React.JSX.Element | undefined;
|
2024-02-12 09:38:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const GanttChartSidebar: React.FC<Props> = (props) => {
|
2024-02-14 12:45:13 +00:00
|
|
|
const { blocks, blockUpdateHandler, enableReorder, sidebarToRender, title, quickAdd } = props;
|
2024-02-12 09:38:17 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
// DO NOT REMOVE THE ID
|
|
|
|
id="gantt-sidebar"
|
2024-02-14 12:45:13 +00:00
|
|
|
className="sticky left-0 z-10 min-h-full h-max flex-shrink-0 border-r-[0.5px] border-custom-border-200 bg-custom-background-100"
|
2024-02-12 09:38:17 +00:00
|
|
|
style={{
|
|
|
|
width: `${SIDEBAR_WIDTH}px`,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
className="box-border flex-shrink-0 flex items-end justify-between gap-2 border-b-[0.5px] border-custom-border-200 pb-2 pl-8 pr-4 text-sm font-medium text-custom-text-300 sticky top-0 z-10 bg-custom-background-100"
|
|
|
|
style={{
|
|
|
|
height: `${HEADER_HEIGHT}px`,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<h6>{title}</h6>
|
|
|
|
<h6>Duration</h6>
|
|
|
|
</div>
|
|
|
|
|
2024-02-14 12:45:13 +00:00
|
|
|
<div className="min-h-full h-max bg-custom-background-100 overflow-x-hidden overflow-y-auto">
|
2024-02-12 09:38:17 +00:00
|
|
|
{sidebarToRender && sidebarToRender({ title, blockUpdateHandler, blocks, enableReorder })}
|
|
|
|
</div>
|
2024-02-14 12:45:13 +00:00
|
|
|
{quickAdd ? quickAdd : null}
|
2024-02-12 09:38:17 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|