Skip to content

Commit 60a69e2

Browse files
fix: issue activity estimate value bug fix (#2281)
* fix: issue activity estimate value bug fix * fix: activity typo fix
1 parent 34af666 commit 60a69e2

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

web/components/core/activity.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { useRouter } from "next/router";
22

33
import useSWR from "swr";
44

5+
// hook
6+
import useEstimateOption from "hooks/use-estimate-option";
57
// services
68
import issuesService from "services/issues.service";
79
// icons
@@ -77,6 +79,18 @@ const LabelPill = ({ labelId }: { labelId: string }) => {
7779
/>
7880
);
7981
};
82+
const EstimatePoint = ({ point }: { point: string }) => {
83+
const { estimateValue, isEstimateActive } = useEstimateOption(Number(point));
84+
const currentPoint = Number(point) + 1;
85+
86+
return (
87+
<span className="font-medium text-custom-text-100">
88+
{isEstimateActive
89+
? estimateValue
90+
: `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`}
91+
</span>
92+
);
93+
};
8094

8195
const activityDetails: {
8296
[key: string]: {
@@ -324,8 +338,7 @@ const activityDetails: {
324338
else
325339
return (
326340
<>
327-
set the estimate point to{" "}
328-
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
341+
set the estimate point to <EstimatePoint point={activity.new_value} />
329342
{showIssue && (
330343
<>
331344
{" "}

web/hooks/use-estimate-option.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ const useEstimateOption = (estimateKey?: number | null) => {
3232
);
3333

3434
const estimateValue: any =
35-
(estimateKey && estimateDetails?.points?.find((e) => e.key === estimateKey)?.value) ?? "None";
35+
estimateKey || estimateKey === 0
36+
? estimateDetails?.points?.find((e) => e.key === estimateKey)?.value
37+
: "None";
3638

3739
return {
3840
isEstimateActive: projectDetails?.estimate ? true : false,

0 commit comments

Comments
 (0)