From 877fca5e64c90d4c24334856b460eea8e6e9b781 Mon Sep 17 00:00:00 2001 From: Brendan Gibson Date: Fri, 15 Dec 2023 10:50:38 -0700 Subject: [PATCH] Fixed bug with grouped rows; Alignment fixes for steps/tasks --- src/components/Timeline/TaskListLabel.tsx | 14 +++++++++++--- src/components/Timeline/useTaskData.ts | 12 ++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/Timeline/TaskListLabel.tsx b/src/components/Timeline/TaskListLabel.tsx index cf003e8a..18456621 100644 --- a/src/components/Timeline/TaskListLabel.tsx +++ b/src/components/Timeline/TaskListLabel.tsx @@ -89,7 +89,7 @@ const TaskListLabel: React.FC = (props) => { tasksTotal === tasksVisible ? tasksTotal : `${tasksVisible}/${tasksTotal}` }`} > - {props.item.step_name} + {props.item.step_name} {!!tasksTotal && ( <> {' '} @@ -129,6 +129,7 @@ const RowLabel = styled.div<{ type: 'step' | 'task'; isOpen?: boolean; group?: b font-weight: ${(p) => (p.type === 'step' ? '600' : 'normal')}; line-height: 1.6875rem; border-left: ${(p) => p.theme.border.thinLight}; + padding-left: ${(p) => (p.type === 'task' ? '0.5rem' : undefined)}; a { display: flex; @@ -158,6 +159,7 @@ const RowStepName = styled.span<{ bigName: boolean }>` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + display: flex; `; const RowDuration = styled.span` @@ -170,8 +172,8 @@ const StepCount = styled.span` `; const RowLabelContent = styled.div<{ type?: 'step' }>` - // In case of step row, lets remove icon width from total width so it aligns nicely - width: ${(p) => (p.type === 'step' ? 'calc(100% - 30px)' : '100%')}; + // In case of step row, lets remove icon and caret width from total width so it aligns nicely + width: ${(p) => (p.type === 'step' ? 'calc(100% - 60px)' : 'calc(100% - 30px)')}; display: flex; justify-content: space-between; `; @@ -217,3 +219,9 @@ const StepLabel = styled.div<{ isLoading: boolean }>` const Padding = styled.div` width: 2.5rem; `; + +const StepNameWithCount = styled.span` + overflow: hidden; + text-overflow: ellipsis; + max-width: 100px; +`; diff --git a/src/components/Timeline/useTaskData.ts b/src/components/Timeline/useTaskData.ts index 81dd92ac..3fbd68f6 100644 --- a/src/components/Timeline/useTaskData.ts +++ b/src/components/Timeline/useTaskData.ts @@ -152,6 +152,7 @@ export function rowDataReducer(state: RowDataModel, action: RowDataAction): RowD } const newEndTime = !row.finished_at || endTime > row.finished_at ? endTime : row.finished_at; + return { ...obj, [key]: { @@ -164,16 +165,19 @@ export function rowDataReducer(state: RowDataModel, action: RowDataAction): RowD }; } // New step entry + + const data = grouped[key].reduce>((dataobj, item) => { + return { ...dataobj, [item.task_id]: makeTasksForStep(dataobj, item) }; + }, {}); + return { ...obj, [key]: { isOpen: true, - status: getStepStatus(grouped), + status: getStepStatus(data), finished_at: endTime, duration: startTime ? endTime - startTime : 0, - data: grouped[key].reduce>((dataobj, item) => { - return { ...dataobj, [item.task_id]: makeTasksForStep(dataobj, item) }; - }, {}), + data, }, }; }, state);