From 0f3c5f3357a3e0a20699cce26c8eab1c107890fd Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 27 Sep 2023 15:32:09 +0530 Subject: [PATCH 1/2] fix: issue activity estimate value bug 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 c76f1aece86..a9354963d88 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 37b42b9e908..61a93ca5942 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, From eba0fca96eacdd16534c332cf4e252b4cd0106cf Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Wed, 27 Sep 2023 16:37:39 +0530 Subject: [PATCH 2/2] fix: activity typo fix --- web/components/core/activity.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/components/core/activity.tsx b/web/components/core/activity.tsx index a9354963d88..4e01c5ed890 100644 --- a/web/components/core/activity.tsx +++ b/web/components/core/activity.tsx @@ -87,7 +87,7 @@ const EstimatePoint = ({ point }: { point: string }) => { {isEstimateActive ? estimateValue - : `${currentPoint} ${currentPoint > 1 ? "Points" : "point"}`} + : `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`} ); };