Skip to content

Commit

Permalink
Planning: Adjust and improve the visual indication of the workflow st…
Browse files Browse the repository at this point in the history
…atus of Coverages (#2029)
  • Loading branch information
dzonidoo authored Jul 24, 2024
1 parent 64011a9 commit 3945157
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions client/utils/planning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
ICoverageScheduledUpdate,
IDateTime,
IItemAction,
IPlanningAssignedTo,
} from '../interfaces';
const appConfig = config as IPlanningConfig;

Expand Down Expand Up @@ -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)';
}
}

Expand Down

0 comments on commit 3945157

Please sign in to comment.