[WEB-522] chore:Estimate structure (#4801)

* dv: seperating constants for ce and ee

* dev: update estimate constants

* dev: updated estimate structure for ce and ee
This commit is contained in:
guru_sainath 2024-06-13 15:51:41 +05:30 committed by GitHub
parent ee4ad580fc
commit 52617baf0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 78 additions and 145 deletions

View file

@ -0,0 +1,42 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { Crown, Pen, Trash } from "lucide-react";
import { Tooltip } from "@plane/ui";
type TEstimateListItem = {
estimateId: string;
isAdmin: boolean;
isEstimateEnabled: boolean;
isEditable: boolean;
onEditClick?: (estimateId: string) => void;
onDeleteClick?: (estimateId: string) => void;
};
export const EstimateListItemButtons: FC<TEstimateListItem> = observer((props) => {
const { estimateId, isAdmin, isEditable, onDeleteClick } = props;
if (!isAdmin || !isEditable) return <></>;
return (
<div className="relative flex items-center gap-1">
<Tooltip
tooltipContent={
<div className="relative flex items-center gap-2">
<div>Upgrade</div>
<Crown size={12} className="text-amber-400" />
</div>
}
position="top"
>
<button className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80">
<Pen size={12} />
</button>
</Tooltip>
<button
className="relative flex-shrink-0 w-6 h-6 flex justify-center items-center rounded cursor-pointer transition-colors overflow-hidden hover:bg-custom-background-80"
onClick={() => onDeleteClick && onDeleteClick(estimateId)}
>
<Trash size={12} />
</button>
</div>
);
});

View file

@ -0,0 +1,3 @@
export * from "./estimate-list-item-buttons";
export * from "./update";

View file

@ -0,0 +1 @@
export * from "./modal";

View file

@ -0,0 +1,14 @@
"use client";
import { FC } from "react";
import { observer } from "mobx-react";
type TUpdateEstimateModal = {
workspaceSlug: string;
projectId: string;
estimateId: string | undefined;
isOpen: boolean;
handleClose: () => void;
};
export const UpdateEstimateModal: FC<TUpdateEstimateModal> = observer(() => <></>);

View file

@ -0,0 +1,123 @@
// types
import { TEstimateSystems } from "@plane/types";
export enum EEstimateSystem {
POINTS = "points",
CATEGORIES = "categories",
TIME = "time",
}
export enum EEstimateUpdateStages {
CREATE = "create",
EDIT = "edit",
SWITCH = "switch",
}
export const estimateCount = {
min: 2,
max: 6,
};
export const ESTIMATE_SYSTEMS: TEstimateSystems = {
points: {
name: "Points",
templates: {
fibonacci: {
title: "Fibonacci",
values: [
{ id: undefined, key: 1, value: "1" },
{ id: undefined, key: 2, value: "2" },
{ id: undefined, key: 3, value: "3" },
{ id: undefined, key: 4, value: "5" },
{ id: undefined, key: 5, value: "8" },
{ id: undefined, key: 6, value: "13" },
],
},
linear: {
title: "Linear",
values: [
{ id: undefined, key: 1, value: "1" },
{ id: undefined, key: 2, value: "2" },
{ id: undefined, key: 3, value: "3" },
{ id: undefined, key: 4, value: "4" },
{ id: undefined, key: 5, value: "5" },
{ id: undefined, key: 6, value: "6" },
],
},
squares: {
title: "Squares",
values: [
{ id: undefined, key: 1, value: "1" },
{ id: undefined, key: 2, value: "4" },
{ id: undefined, key: 3, value: "9" },
{ id: undefined, key: 4, value: "16" },
{ id: undefined, key: 5, value: "25" },
{ id: undefined, key: 6, value: "36" },
],
},
custom: {
title: "Custom",
values: [
{ id: undefined, key: 1, value: "1" },
{ id: undefined, key: 2, value: "2" },
],
hide: true,
},
},
is_available: true,
is_ee: false,
},
categories: {
name: "Categories",
templates: {
t_shirt_sizes: {
title: "T-Shirt Sizes",
values: [
{ id: undefined, key: 1, value: "XS" },
{ id: undefined, key: 2, value: "S" },
{ id: undefined, key: 3, value: "M" },
{ id: undefined, key: 4, value: "L" },
{ id: undefined, key: 5, value: "XL" },
{ id: undefined, key: 6, value: "XXL" },
],
},
easy_to_hard: {
title: "Easy to hard",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Medium" },
{ id: undefined, key: 3, value: "Hard" },
{ id: undefined, key: 4, value: "Very Hard" },
],
},
custom: {
title: "Custom",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Hard" },
],
hide: true,
},
},
is_available: true,
is_ee: false,
},
time: {
name: "Time",
templates: {
hours: {
title: "Hours",
values: [
{ id: undefined, key: 1, value: "1" },
{ id: undefined, key: 2, value: "2" },
{ id: undefined, key: 3, value: "3" },
{ id: undefined, key: 4, value: "4" },
{ id: undefined, key: 5, value: "5" },
{ id: undefined, key: 6, value: "6" },
],
},
},
is_available: false,
is_ee: true,
},
};