From 463026cf7ed0a105d64b684b70996eaf21ceaa9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Rode=20Gj=C3=B8sund?= <54101675+MagnusGjosund@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:22:08 +0200 Subject: [PATCH] fix: :bug: Pipetest - fix vertical sorting in garden (#957) --- .../src/lib/utils-garden/getPipetestStatusColors.ts | 11 +++++++---- libs/pipingapp/src/lib/utils-garden/getTextColor.ts | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 libs/pipingapp/src/lib/utils-garden/getTextColor.ts diff --git a/libs/pipingapp/src/lib/utils-garden/getPipetestStatusColors.ts b/libs/pipingapp/src/lib/utils-garden/getPipetestStatusColors.ts index 88935009e..18a101b57 100644 --- a/libs/pipingapp/src/lib/utils-garden/getPipetestStatusColors.ts +++ b/libs/pipingapp/src/lib/utils-garden/getPipetestStatusColors.ts @@ -1,12 +1,15 @@ import { Pipetest } from '@cc-components/pipingshared'; -import { pipetestStatusColormap } from '@cc-components/shared/mapping'; -import { BaseStatus } from 'libs/shared/dist/src/packages'; +import { pipetestAndHeatTraceColorMap } from '@cc-components/shared/mapping'; +import { getTextColor } from './getTextColor'; type PackageStatusReturn = { backgroundColor: string; + textColor: string; }; export const getPipetestStatusColors = (data: Pipetest): PackageStatusReturn => { - const backgroundColor = pipetestStatusColormap[data.formStatus as BaseStatus]; - return { backgroundColor }; + const backgroundColor = pipetestAndHeatTraceColorMap[data.checklistStep || '']; + const textColor = getTextColor(data.checklistStep || ''); + + return { backgroundColor: backgroundColor, textColor: textColor }; }; diff --git a/libs/pipingapp/src/lib/utils-garden/getTextColor.ts b/libs/pipingapp/src/lib/utils-garden/getTextColor.ts new file mode 100644 index 000000000..2cabec385 --- /dev/null +++ b/libs/pipingapp/src/lib/utils-garden/getTextColor.ts @@ -0,0 +1,6 @@ +export const getTextColor = (status: string) => { + if (status === 'Pressure test' || status === 'Insulation' || status === 'Complete') + return '#000000'; + + return '#ffffff'; +};