forked from github/plane
fix: issue activity estimate value bug fix (#2281)
* fix: issue activity estimate value bug fix * fix: activity typo fix
This commit is contained in:
parent
34af666b5f
commit
60a69e28e3
@ -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 (
|
||||
<span className="font-medium text-custom-text-100">
|
||||
{isEstimateActive
|
||||
? estimateValue
|
||||
: `${currentPoint} ${currentPoint > 1 ? "points" : "point"}`}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
const activityDetails: {
|
||||
[key: string]: {
|
||||
@ -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 && (
|
||||
<>
|
||||
{" "}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user