From 60a69e28e3eb0ea3528df6c1c02ea94dd81f2f91 Mon Sep 17 00:00:00 2001
From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>
Date: Thu, 28 Sep 2023 13:18:35 +0530
Subject: [PATCH] fix: issue activity estimate value bug fix (#2281)
* fix: issue activity estimate value bug fix
* fix: activity typo fix
---
web/components/core/activity.tsx | 17 +++++++++++++++--
web/hooks/use-estimate-option.tsx | 4 +++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/web/components/core/activity.tsx b/web/components/core/activity.tsx
index c76f1aece..4e01c5ed8 100644
--- a/web/components/core/activity.tsx
+++ b/web/components/core/activity.tsx
@@ -2,6 +2,8 @@ import { useRouter } from "next/router";
import useSWR from "swr";
+// hook
+import useEstimateOption from "hooks/use-estimate-option";
// services
import issuesService from "services/issues.service";
// icons
@@ -77,6 +79,18 @@ const LabelPill = ({ labelId }: { labelId: string }) => {
/>
);
};
+const EstimatePoint = ({ point }: { point: string }) => {
+ const { estimateValue, isEstimateActive } = useEstimateOption(Number(point));
+ const currentPoint = Number(point) + 1;
+
+ return (
+
+ {isEstimateActive
+ ? estimateValue
+ : `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`}
+
+ );
+};
const activityDetails: {
[key: string]: {
@@ -324,8 +338,7 @@ const activityDetails: {
else
return (
<>
- set the estimate point to{" "}
- {activity.new_value}
+ set the estimate point to
{showIssue && (
<>
{" "}
diff --git a/web/hooks/use-estimate-option.tsx b/web/hooks/use-estimate-option.tsx
index 37b42b9e9..61a93ca59 100644
--- a/web/hooks/use-estimate-option.tsx
+++ b/web/hooks/use-estimate-option.tsx
@@ -32,7 +32,9 @@ const useEstimateOption = (estimateKey?: number | null) => {
);
const estimateValue: any =
- (estimateKey && estimateDetails?.points?.find((e) => e.key === estimateKey)?.value) ?? "None";
+ estimateKey || estimateKey === 0
+ ? estimateDetails?.points?.find((e) => e.key === estimateKey)?.value
+ : "None";
return {
isEstimateActive: projectDetails?.estimate ? true : false,