fix: sidebar height, authorization (#3626)

This commit is contained in:
Aaryan Khandelwal 2024-02-12 19:10:07 +05:30 committed by GitHub
parent 9cf5348019
commit fc8edab59b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 65 additions and 54 deletions

View File

@ -20,6 +20,7 @@ export type GanttChartBlocksProps = {
enableBlockLeftResize: boolean; enableBlockLeftResize: boolean;
enableBlockRightResize: boolean; enableBlockRightResize: boolean;
enableBlockMove: boolean; enableBlockMove: boolean;
enableAddBlock: boolean;
showAllBlocks: boolean; showAllBlocks: boolean;
}; };
@ -32,6 +33,7 @@ export const GanttChartBlocksList: FC<GanttChartBlocksProps> = observer((props)
enableBlockLeftResize, enableBlockLeftResize,
enableBlockRightResize, enableBlockRightResize,
enableBlockMove, enableBlockMove,
enableAddBlock,
showAllBlocks, showAllBlocks,
} = props; } = props;
// store hooks // store hooks
@ -120,7 +122,7 @@ export const GanttChartBlocksList: FC<GanttChartBlocksProps> = observer((props)
enableBlockMove={enableBlockMove} enableBlockMove={enableBlockMove}
/> />
) : ( ) : (
<ChartAddBlock block={block} blockUpdateHandler={blockUpdateHandler} /> enableAddBlock && <ChartAddBlock block={block} blockUpdateHandler={blockUpdateHandler} />
)} )}
</div> </div>
</div> </div>

View File

@ -27,6 +27,7 @@ type Props = {
enableBlockMove: boolean; enableBlockMove: boolean;
enableBlockRightResize: boolean; enableBlockRightResize: boolean;
enableReorder: boolean; enableReorder: boolean;
enableAddBlock: boolean;
itemsContainerWidth: number; itemsContainerWidth: number;
showAllBlocks: boolean; showAllBlocks: boolean;
sidebarToRender: (props: any) => React.ReactNode; sidebarToRender: (props: any) => React.ReactNode;
@ -45,6 +46,7 @@ export const GanttChartMainContent: React.FC<Props> = (props) => {
enableBlockMove, enableBlockMove,
enableBlockRightResize, enableBlockRightResize,
enableReorder, enableReorder,
enableAddBlock,
itemsContainerWidth, itemsContainerWidth,
showAllBlocks, showAllBlocks,
sidebarToRender, sidebarToRender,
@ -111,6 +113,7 @@ export const GanttChartMainContent: React.FC<Props> = (props) => {
enableBlockLeftResize={enableBlockLeftResize} enableBlockLeftResize={enableBlockLeftResize}
enableBlockRightResize={enableBlockRightResize} enableBlockRightResize={enableBlockRightResize}
enableBlockMove={enableBlockMove} enableBlockMove={enableBlockMove}
enableAddBlock={enableAddBlock}
showAllBlocks={showAllBlocks} showAllBlocks={showAllBlocks}
/> />
)} )}

View File

@ -28,6 +28,7 @@ type ChartViewRootProps = {
enableBlockRightResize: boolean; enableBlockRightResize: boolean;
enableBlockMove: boolean; enableBlockMove: boolean;
enableReorder: boolean; enableReorder: boolean;
enableAddBlock: boolean;
bottomSpacing: boolean; bottomSpacing: boolean;
showAllBlocks: boolean; showAllBlocks: boolean;
}; };
@ -45,6 +46,7 @@ export const ChartViewRoot: FC<ChartViewRootProps> = (props) => {
enableBlockRightResize, enableBlockRightResize,
enableBlockMove, enableBlockMove,
enableReorder, enableReorder,
enableAddBlock,
bottomSpacing, bottomSpacing,
showAllBlocks, showAllBlocks,
} = props; } = props;
@ -192,6 +194,7 @@ export const ChartViewRoot: FC<ChartViewRootProps> = (props) => {
enableBlockMove={enableBlockMove} enableBlockMove={enableBlockMove}
enableBlockRightResize={enableBlockRightResize} enableBlockRightResize={enableBlockRightResize}
enableReorder={enableReorder} enableReorder={enableReorder}
enableAddBlock={enableAddBlock}
itemsContainerWidth={itemsContainerWidth} itemsContainerWidth={itemsContainerWidth}
showAllBlocks={showAllBlocks} showAllBlocks={showAllBlocks}
sidebarToRender={sidebarToRender} sidebarToRender={sidebarToRender}

View File

@ -14,63 +14,61 @@ export const MonthChartView: FC<any> = () => {
const monthBlocks: IMonthBlock[] = renderView; const monthBlocks: IMonthBlock[] = renderView;
return ( return (
<> <div className="absolute top-0 left-0 h-full w-max flex divide-x divide-custom-border-100/50">
<div className="absolute top-0 left-0 h-full w-max flex divide-x divide-custom-border-100/50"> {monthBlocks?.map((block, rootIndex) => (
{monthBlocks?.map((block, rootIndex) => ( <div key={`month-${block?.month}-${block?.year}`} className="relative">
<div key={`month-${block?.month}-${block?.year}`} className="relative"> <div
<div className="w-full sticky top-0 z-[5] bg-custom-background-100"
className="w-full sticky top-0 z-[5] bg-custom-background-100" style={{
style={{ height: `${HEADER_HEIGHT}px`,
height: `${HEADER_HEIGHT}px`, }}
}} >
> <div className="h-1/2">
<div className="h-1/2"> <div
<div className="sticky inline-flex whitespace-nowrap px-3 py-2 text-xs font-medium capitalize"
className="sticky inline-flex whitespace-nowrap px-3 py-2 text-xs font-medium capitalize" style={{
style={{ left: `${SIDEBAR_WIDTH}px`,
left: `${SIDEBAR_WIDTH}px`, }}
}} >
> {block?.title}
{block?.title}
</div>
</div>
<div className="h-1/2 w-full flex">
{block?.children?.map((monthDay, index) => (
<div
key={`sub-title-${rootIndex}-${index}`}
className="flex-shrink-0 border-b-[0.5px] border-custom-border-200 py-1 text-center capitalize"
style={{ width: `${currentViewData?.data.width}px` }}
>
<div className="space-x-1 text-xs">
<span className="text-custom-text-200">{monthDay.dayData.shortTitle[0]}</span>{" "}
<span
className={cn({
"rounded-full bg-custom-primary-100 px-1 text-white": monthDay.today,
})}
>
{monthDay.day}
</span>
</div>
</div>
))}
</div> </div>
</div> </div>
<div className="h-full w-full flex divide-x divide-custom-border-100/50"> <div className="h-1/2 w-full flex">
{block?.children?.map((monthDay, index) => ( {block?.children?.map((monthDay, index) => (
<div <div
key={`column-${rootIndex}-${index}`} key={`sub-title-${rootIndex}-${index}`}
className="h-full overflow-hidden" className="flex-shrink-0 border-b-[0.5px] border-custom-border-200 py-1 text-center capitalize"
style={{ width: `${currentViewData?.data.width}px` }} style={{ width: `${currentViewData?.data.width}px` }}
> >
{["sat", "sun"].includes(monthDay?.dayData?.shortTitle) && ( <div className="space-x-1 text-xs">
<div className="h-full bg-custom-background-90" /> <span className="text-custom-text-200">{monthDay.dayData.shortTitle[0]}</span>{" "}
)} <span
className={cn({
"rounded-full bg-custom-primary-100 px-1 text-white": monthDay.today,
})}
>
{monthDay.day}
</span>
</div>
</div> </div>
))} ))}
</div> </div>
</div> </div>
))} <div className="h-full w-full flex divide-x divide-custom-border-100/50">
</div> {block?.children?.map((monthDay, index) => (
</> <div
key={`column-${rootIndex}-${index}`}
className="h-full overflow-hidden"
style={{ width: `${currentViewData?.data.width}px` }}
>
{["sat", "sun"].includes(monthDay?.dayData?.shortTitle) && (
<div className="h-full bg-custom-background-90" />
)}
</div>
))}
</div>
</div>
))}
</div>
); );
}; };

View File

@ -16,6 +16,7 @@ type GanttChartRootProps = {
enableBlockRightResize?: boolean; enableBlockRightResize?: boolean;
enableBlockMove?: boolean; enableBlockMove?: boolean;
enableReorder?: boolean; enableReorder?: boolean;
enableAddBlock?: boolean;
bottomSpacing?: boolean; bottomSpacing?: boolean;
showAllBlocks?: boolean; showAllBlocks?: boolean;
}; };
@ -29,10 +30,11 @@ export const GanttChartRoot: FC<GanttChartRootProps> = (props) => {
blockUpdateHandler, blockUpdateHandler,
sidebarToRender, sidebarToRender,
blockToRender, blockToRender,
enableBlockLeftResize = true, enableBlockLeftResize = false,
enableBlockRightResize = true, enableBlockRightResize = false,
enableBlockMove = true, enableBlockMove = false,
enableReorder = true, enableReorder = false,
enableAddBlock = false,
bottomSpacing = false, bottomSpacing = false,
showAllBlocks = false, showAllBlocks = false,
} = props; } = props;
@ -51,6 +53,7 @@ export const GanttChartRoot: FC<GanttChartRootProps> = (props) => {
enableBlockRightResize={enableBlockRightResize} enableBlockRightResize={enableBlockRightResize}
enableBlockMove={enableBlockMove} enableBlockMove={enableBlockMove}
enableReorder={enableReorder} enableReorder={enableReorder}
enableAddBlock={enableAddBlock}
bottomSpacing={bottomSpacing} bottomSpacing={bottomSpacing}
showAllBlocks={showAllBlocks} showAllBlocks={showAllBlocks}
/> />

View File

@ -18,7 +18,7 @@ export const GanttChartSidebar: React.FC<Props> = (props) => {
<div <div
// DO NOT REMOVE THE ID // DO NOT REMOVE THE ID
id="gantt-sidebar" id="gantt-sidebar"
className="sticky left-0 z-10 min-h-full h-max flex-shrink-0 border-r-[0.5px] border-custom-border-200" className="sticky top-0 left-0 z-10 min-h-full h-max flex-shrink-0 border-r-[0.5px] border-custom-border-200 bg-custom-background-100"
style={{ style={{
width: `${SIDEBAR_WIDTH}px`, width: `${SIDEBAR_WIDTH}px`,
}} }}

View File

@ -84,6 +84,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
enableBlockRightResize={isAllowed} enableBlockRightResize={isAllowed}
enableBlockMove={isAllowed} enableBlockMove={isAllowed}
enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed} enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed}
enableAddBlock={isAllowed}
showAllBlocks showAllBlocks
/> />
</div> </div>

View File

@ -52,6 +52,7 @@ export const ModulesListGanttChartView: React.FC = observer(() => {
enableBlockRightResize={isAllowed} enableBlockRightResize={isAllowed}
enableBlockMove={isAllowed} enableBlockMove={isAllowed}
enableReorder={isAllowed} enableReorder={isAllowed}
enableAddBlock={isAllowed}
showAllBlocks showAllBlocks
/> />
</div> </div>