From 81b706b4f5f7dc7c8f039979713b02fbf050a957 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Wed, 27 Sep 2023 13:17:38 +0530 Subject: [PATCH 1/2] chore: gantt empty state --- web/components/gantt-chart/chart/index.tsx | 4 +- web/components/gantt-chart/sidebar.tsx | 80 ++++++++++------------ 2 files changed, 39 insertions(+), 45 deletions(-) diff --git a/web/components/gantt-chart/chart/index.tsx b/web/components/gantt-chart/chart/index.tsx index a8f541b0b0f..d9c3ae1a49b 100644 --- a/web/components/gantt-chart/chart/index.tsx +++ b/web/components/gantt-chart/chart/index.tsx @@ -304,7 +304,7 @@ export const ChartViewRoot: FC = ({ >
= ({ enableReorder={enableReorder} /> {chartBlocks && ( -
+
setIsCreateIssueFormOpen(false)} diff --git a/web/components/gantt-chart/sidebar.tsx b/web/components/gantt-chart/sidebar.tsx index 4a804f79563..1cc2b052684 100644 --- a/web/components/gantt-chart/sidebar.tsx +++ b/web/components/gantt-chart/sidebar.tsx @@ -86,59 +86,53 @@ export const GanttSidebar: React.FC = (props) => { {(droppableProvided) => (
<> {blocks ? ( - blocks.length > 0 ? ( - blocks.map((block, index) => ( - - {(provided, snapshot) => ( + blocks.map((block, index) => ( + + {(provided, snapshot) => ( +
updateActiveBlock(block)} + onMouseLeave={() => updateActiveBlock(null)} + ref={provided.innerRef} + {...provided.draggableProps} + >
updateActiveBlock(block)} - onMouseLeave={() => updateActiveBlock(null)} - ref={provided.innerRef} - {...provided.draggableProps} > -
- {enableReorder && ( - - )} -
- -
+ {enableReorder && ( + + )} +
+
- )} - - )) - ) : ( -
- No {title} found -
- ) +
+ )} + + )) ) : ( From 962d171784ec745735ec9f5e525df77272a28ef3 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Wed, 27 Sep 2023 13:37:00 +0530 Subject: [PATCH 2/2] chore: Add heading to the gantt sidebar --- web/components/gantt-chart/chart/index.tsx | 5 +- web/components/gantt-chart/sidebar.tsx | 87 ++++++++++++-------- web/components/issues/gantt-chart/blocks.tsx | 11 +-- 3 files changed, 57 insertions(+), 46 deletions(-) diff --git a/web/components/gantt-chart/chart/index.tsx b/web/components/gantt-chart/chart/index.tsx index d9c3ae1a49b..c564f69f2d4 100644 --- a/web/components/gantt-chart/chart/index.tsx +++ b/web/components/gantt-chart/chart/index.tsx @@ -306,7 +306,10 @@ export const ChartViewRoot: FC = ({ id="gantt-sidebar" className="h-full w-1/4 flex flex-col border-r border-custom-border-200" > -
+
+
{title}
+
Duration
+
= (props) => { > <> {blocks ? ( - blocks.map((block, index) => ( - - {(provided, snapshot) => ( -
updateActiveBlock(block)} - onMouseLeave={() => updateActiveBlock(null)} - ref={provided.innerRef} - {...provided.draggableProps} - > + blocks.map((block, index) => { + const duration = findTotalDaysInRange( + block.start_date ?? "", + block.target_date ?? "", + true + ); + + return ( + + {(provided, snapshot) => (
updateActiveBlock(block)} + onMouseLeave={() => updateActiveBlock(null)} + ref={provided.innerRef} + {...provided.draggableProps} > - {enableReorder && ( - - )} -
- +
+ {enableReorder && ( + + )} +
+
+ +
+
+ {duration} day{duration > 1 ? "s" : ""} +
+
-
- )} -
- )) + )} + + ); + }) ) : ( diff --git a/web/components/issues/gantt-chart/blocks.tsx b/web/components/issues/gantt-chart/blocks.tsx index ef4919780cb..3364565a3aa 100644 --- a/web/components/issues/gantt-chart/blocks.tsx +++ b/web/components/issues/gantt-chart/blocks.tsx @@ -5,7 +5,7 @@ import { Tooltip } from "components/ui"; // icons import { StateGroupIcon } from "components/icons"; // helpers -import { findTotalDaysInRange, renderShortDate } from "helpers/date-time.helper"; +import { renderShortDate } from "helpers/date-time.helper"; // types import { IIssue } from "types"; @@ -52,8 +52,6 @@ export const IssueGanttBlock = ({ data }: { data: IIssue }) => { export const IssueGanttSidebarBlock = ({ data }: { data: IIssue }) => { const router = useRouter(); - const duration = findTotalDaysInRange(data?.start_date ?? "", data?.target_date ?? "", true); - const openPeekOverview = () => { const { query } = router; @@ -72,12 +70,7 @@ export const IssueGanttSidebarBlock = ({ data }: { data: IIssue }) => {
{data?.project_detail?.identifier} {data?.sequence_id}
-
-
{data?.name}
- - {duration} day{duration > 1 ? "s" : ""} - -
+
{data?.name}
); };