dev: update estimate constants

This commit is contained in:
gurusainath 2024-06-13 14:32:10 +05:30
parent edbc707199
commit 362731ad2a
5 changed files with 14 additions and 9 deletions

View File

@ -13,8 +13,10 @@ export enum EEstimateUpdateStages {
SWITCH = "switch",
}
export const minEstimatesCount = 2;
export const maxEstimatesCount = 6;
export const estimateCount = {
min: 2,
max: 6,
};
export const ESTIMATE_SYSTEMS: TEstimateSystems = {
points: {

View File

@ -8,7 +8,7 @@ import { Button, Sortable } from "@plane/ui";
// components
import { EstimatePointCreate, EstimatePointItemPreview } from "@/components/estimates/points";
// plane web constants
import { maxEstimatesCount } from "@/plane-web/constants/estimates";
import { estimateCount } from "@/plane-web/constants/estimates";
type TEstimatePointCreateRoot = {
workspaceSlug: string;
@ -89,7 +89,7 @@ export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((p
};
const handleCreate = () => {
if (estimatePoints && estimatePoints.length + (estimatePointCreate?.length || 0) <= maxEstimatesCount - 1) {
if (estimatePoints && estimatePoints.length + (estimatePointCreate?.length || 0) <= estimateCount.max - 1) {
handleEstimatePointCreate("add", {
id: undefined,
key: estimatePoints.length + (estimatePointCreate?.length || 0) + 1,
@ -143,7 +143,7 @@ export const EstimatePointCreateRoot: FC<TEstimatePointCreateRoot> = observer((p
isError={estimatePointCreateError.includes(estimatePoint.key) ? true : false}
/>
))}
{estimatePoints && estimatePoints.length + (estimatePointCreate?.length || 0) <= maxEstimatesCount - 1 && (
{estimatePoints && estimatePoints.length + (estimatePointCreate?.length || 0) <= estimateCount.max - 1 && (
<Button variant="link-primary" size="sm" prependIcon={<Plus />} onClick={handleCreate}>
Add {estimateType}
</Button>

View File

@ -5,7 +5,7 @@ import { TEstimatePointsObject, TEstimateSystemKeys } from "@plane/types";
// components
import { EstimatePointUpdate, EstimatePointDelete } from "@/components/estimates/points";
// plane web constants
import { minEstimatesCount } from "@/plane-web/constants/estimates";
import { estimateCount } from "@/plane-web/constants/estimates";
type TEstimatePointItemPreview = {
workspaceSlug: string;
@ -62,7 +62,7 @@ export const EstimatePointItemPreview: FC<TEstimatePointItemPreview> = observer(
>
<Pencil size={14} className="text-custom-text-200" />
</div>
{estimatePoints.length > minEstimatesCount && (
{estimatePoints.length > estimateCount.min && (
<div
className="rounded-sm w-6 h-6 flex-shrink-0 relative flex justify-center items-center hover:bg-custom-background-80 transition-colors cursor-pointer"
onClick={() =>

View File

@ -13,8 +13,8 @@ export enum EEstimateUpdateStages {
SWITCH = "switch",
}
export const minEstimatesCount = 2;
export const maxEstimatesCount = 6;
export const estimateCount.min = 2;
export const estimateCount.max = 6;
export const ESTIMATE_SYSTEMS: TEstimateSystems = {
points: {

View File

@ -0,0 +1,3 @@
import * as ceConstants from "@/plane-web/constants/estimates";
export { ceConstants };