From 6bec327f617b3d574cdfd32daae1172db98de204 Mon Sep 17 00:00:00 2001
From: Vyacheslav Tumanov <me@slavatumanov.me>
Date: Thu, 30 May 2024 10:22:45 +0500
Subject: [PATCH] UBERF-7105: Use status colour when projectState is undefined
 (#5697)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
---
 .../components/state/StatePresenter.svelte    | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/plugins/task-resources/src/components/state/StatePresenter.svelte b/plugins/task-resources/src/components/state/StatePresenter.svelte
index ebca230789..bb2ac2acda 100644
--- a/plugins/task-resources/src/components/state/StatePresenter.svelte
+++ b/plugins/task-resources/src/components/state/StatePresenter.svelte
@@ -135,18 +135,22 @@
   {#if kind === 'table-attrs'}
     <button class="hulyTableAttr-content__row-icon-wrapper" on:click>
       {#if icon != null}
-        <Icon {icon} {size} iconProps={{ icon: projectState?.color ?? category?.color }} />
+        <Icon {icon} {size} iconProps={{ icon: projectState?.color ?? value?.color ?? category?.color }} />
       {:else if category?._id === task.statusCategory.Active}
         <Icon
           icon={categoryIcons[category._id]}
           {size}
-          iconProps={{ index, count: sameCategory.length + 1, fill: projectState?.color ?? category?.color }}
+          iconProps={{
+            index,
+            count: sameCategory.length + 1,
+            fill: projectState?.color ?? value?.color ?? category?.color
+          }}
         />
       {:else}
         <Icon
           icon={categoryIcons[category?._id ?? task.statusCategory.UnStarted]}
           {size}
-          iconProps={{ fill: projectState?.color ?? category?.color }}
+          iconProps={{ fill: projectState?.color ?? value?.color ?? category?.color }}
         />
       {/if}
     </button>
@@ -175,18 +179,22 @@
           title={shouldShowTooltip ? value.name : undefined}
         >
           {#if icon != null}
-            <Icon {icon} {size} iconProps={{ icon: projectState?.color ?? category?.color }} />
+            <Icon {icon} {size} iconProps={{ icon: projectState?.color ?? value?.color ?? category?.color }} />
           {:else if category?._id === task.statusCategory.Active}
             <Icon
               icon={categoryIcons[category._id]}
               {size}
-              iconProps={{ index, count: sameCategory.length + 1, fill: projectState?.color ?? category?.color }}
+              iconProps={{
+                index,
+                count: sameCategory.length + 1,
+                fill: projectState?.color ?? value?.color ?? category?.color
+              }}
             />
           {:else}
             <Icon
               icon={categoryIcons[category?._id ?? task.statusCategory.UnStarted]}
               {size}
-              iconProps={{ fill: projectState?.color ?? category?.color }}
+              iconProps={{ fill: projectState?.color ?? value?.color ?? category?.color }}
             />
           {/if}
         </div>