Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions web/components/core/activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
<span className="font-medium text-custom-text-100">
{isEstimateActive
? estimateValue
: `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`}
</span>
);
};

const activityDetails: {
[key: string]: {
Expand Down Expand Up @@ -324,8 +338,7 @@ const activityDetails: {
else
return (
<>
set the estimate point to{" "}
<span className="font-medium text-custom-text-100">{activity.new_value}</span>
set the estimate point to <EstimatePoint point={activity.new_value} />
{showIssue && (
<>
{" "}
Expand Down
4 changes: 3 additions & 1 deletion web/hooks/use-estimate-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down