From 39451571fc8b1966b5fdcb97bbee7252c754ea73 Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:16:20 +0200 Subject: [PATCH] Planning: Adjust and improve the visual indication of the workflow status of Coverages (#2029) --- client/utils/planning.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/client/utils/planning.ts b/client/utils/planning.ts index 081e76a34..c3a46712b 100644 --- a/client/utils/planning.ts +++ b/client/utils/planning.ts @@ -21,6 +21,7 @@ import { ICoverageScheduledUpdate, IDateTime, IItemAction, + IPlanningAssignedTo, } from '../interfaces'; const appConfig = config as IPlanningConfig; @@ -1223,15 +1224,28 @@ function getCoverageIcon( return coverageIcons[type]?.[iconType] ?? iconForUnknownType; } -function getCoverageIconColor(coverage: IPlanningCoverageItem): string { - if (coverage.workflow_status === COVERAGES.WORKFLOW_STATE.ACTIVE) { - return 'var(--sd-colour-success)'; - } else if (get(coverage, 'assigned_to.state') === ASSIGNMENTS.WORKFLOW_STATE.COMPLETED) { - return 'var(--sd-colour-success)'; - } else if (isCoverageDraft(coverage) || get(coverage, 'workflow_status') === COVERAGES.WORKFLOW_STATE.ACTIVE) { - return 'var(--sd-colour-highlight)'; +function getCoverageIconColor(item: IPlanningCoverageItem): string | undefined { + if (item.workflow_status === 'cancelled') { + return 'var(--sd-colour-state--canceled)'; + } + + if (item.assigned_to == null) { + return undefined; + } + + switch (getItemWorkflowState(item.assigned_to)) { + case ASSIGNMENTS.WORKFLOW_STATE.ASSIGNED: + return 'var(--sd-colour-state--in-workflow)'; + case ASSIGNMENTS.WORKFLOW_STATE.IN_PROGRESS: + return 'var(--sd-colour-state--in-progress)'; + case ASSIGNMENTS.WORKFLOW_STATE.COMPLETED: + return 'var(--sd-colour-state--completed)'; + } + + if (item.assigned_to.user != null || item.assigned_to.desk != null) { + return 'var(--sd-colour-state--assigned)'; } else { - return 'var(--color-text-lighter)'; + return 'var(--sd-colour-state--unassigned)'; } }