From d8df1022d2de6aecde8c6759f1ca3c2a96347c54 Mon Sep 17 00:00:00 2001 From: gurusainath Date: Thu, 13 Jun 2024 15:41:34 +0530 Subject: [PATCH] dev: updated estimate structure for ce and ee --- .../estimates/estimate-list-item-buttons.tsx | 24 ++-- web/ce/components/estimates/index.ts | 3 + web/ce/components/estimates/update/index.ts | 1 + web/ce/components/estimates/update/modal.tsx | 14 ++ web/ce/constants/estimates.ts | 15 -- .../estimates/estimate-list-item.tsx | 3 +- web/core/components/estimates/index.ts | 4 - web/core/components/estimates/root.tsx | 3 +- web/core/components/estimates/update/index.ts | 2 - .../components/estimates/update/modal.tsx | 44 ------ .../components/estimates/update/stage-one.tsx | 44 ------ web/core/constants/estimates.ts | 136 ------------------ .../estimates/estimate-list-item-buttons.tsx | 1 + web/ee/components/estimates/index.ts | 1 + web/ee/components/estimates/update/index.ts | 1 + web/ee/components/estimates/update/modal.tsx | 1 + web/ee/constants/estimates.ts | 4 +- 17 files changed, 43 insertions(+), 258 deletions(-) rename web/{core => ce}/components/estimates/estimate-list-item-buttons.tsx (56%) create mode 100644 web/ce/components/estimates/index.ts create mode 100644 web/ce/components/estimates/update/index.ts create mode 100644 web/ce/components/estimates/update/modal.tsx delete mode 100644 web/core/components/estimates/update/index.ts delete mode 100644 web/core/components/estimates/update/modal.tsx delete mode 100644 web/core/components/estimates/update/stage-one.tsx delete mode 100644 web/core/constants/estimates.ts create mode 100644 web/ee/components/estimates/estimate-list-item-buttons.tsx create mode 100644 web/ee/components/estimates/index.ts create mode 100644 web/ee/components/estimates/update/index.ts create mode 100644 web/ee/components/estimates/update/modal.tsx diff --git a/web/core/components/estimates/estimate-list-item-buttons.tsx b/web/ce/components/estimates/estimate-list-item-buttons.tsx similarity index 56% rename from web/core/components/estimates/estimate-list-item-buttons.tsx rename to web/ce/components/estimates/estimate-list-item-buttons.tsx index d2da059ee..6911754f8 100644 --- a/web/core/components/estimates/estimate-list-item-buttons.tsx +++ b/web/ce/components/estimates/estimate-list-item-buttons.tsx @@ -1,6 +1,7 @@ import { FC } from "react"; import { observer } from "mobx-react"; -import { Pen, Trash } from "lucide-react"; +import { Crown, Pen, Trash } from "lucide-react"; +import { Tooltip } from "@plane/ui"; type TEstimateListItem = { estimateId: string; @@ -12,17 +13,24 @@ type TEstimateListItem = { }; export const EstimateListItemButtons: FC = observer((props) => { - const { estimateId, isAdmin, isEditable, onEditClick, onDeleteClick } = props; - if (!isAdmin || !isEditable) return <>; + const { estimateId, isAdmin, isEditable, onDeleteClick } = props; + if (!isAdmin || !isEditable) return <>; return (
-
+ } + position="top" > - - + + - - - - ); -}); diff --git a/web/core/components/estimates/update/stage-one.tsx b/web/core/components/estimates/update/stage-one.tsx deleted file mode 100644 index b64f7eb52..000000000 --- a/web/core/components/estimates/update/stage-one.tsx +++ /dev/null @@ -1,44 +0,0 @@ -"use client"; - -import { FC } from "react"; -import { Crown } from "lucide-react"; -import { TEstimateUpdateStageKeys } from "@plane/types"; -import { Tooltip } from "@plane/ui"; -// helpers -import { cn } from "@/helpers/common.helper"; -// plane web constants -import { ESTIMATE_OPTIONS_STAGE_ONE } from "@/plane-web/constants/estimates"; - -type TEstimateUpdateStageOne = { - handleEstimateEditType?: (stage: TEstimateUpdateStageKeys) => void; -}; - -export const EstimateUpdateStageOne: FC = (props) => { - const { handleEstimateEditType } = props; - - return ( -
- {ESTIMATE_OPTIONS_STAGE_ONE && - ESTIMATE_OPTIONS_STAGE_ONE.map((stage) => ( -
!stage?.is_ee && handleEstimateEditType && handleEstimateEditType(stage.key)} - > -

- {stage.title} - {stage?.is_ee && ( - - - - )} -

-

{stage.description}

-
- ))} -
- ); -}; diff --git a/web/core/constants/estimates.ts b/web/core/constants/estimates.ts deleted file mode 100644 index d50c55093..000000000 --- a/web/core/constants/estimates.ts +++ /dev/null @@ -1,136 +0,0 @@ -// 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; -export const estimateCount.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, - }, -}; - -export const ESTIMATE_OPTIONS_STAGE_ONE = [ - { - key: EEstimateUpdateStages.EDIT, - title: "Add, update or remove estimates", - description: "Manage current system either adding, updating or removing the points or categories.", - is_ee: true, - }, - { - key: EEstimateUpdateStages.SWITCH, - title: "Change estimate type", - description: "Convert your points system to categories system and vice versa.", - is_ee: true, - }, -]; diff --git a/web/ee/components/estimates/estimate-list-item-buttons.tsx b/web/ee/components/estimates/estimate-list-item-buttons.tsx new file mode 100644 index 000000000..4e5008ea5 --- /dev/null +++ b/web/ee/components/estimates/estimate-list-item-buttons.tsx @@ -0,0 +1 @@ +export * from "ce/components/estimates/estimate-list-item-buttons"; diff --git a/web/ee/components/estimates/index.ts b/web/ee/components/estimates/index.ts new file mode 100644 index 000000000..669788276 --- /dev/null +++ b/web/ee/components/estimates/index.ts @@ -0,0 +1 @@ +export * from "./estimate-list-item-buttons"; diff --git a/web/ee/components/estimates/update/index.ts b/web/ee/components/estimates/update/index.ts new file mode 100644 index 000000000..031608e25 --- /dev/null +++ b/web/ee/components/estimates/update/index.ts @@ -0,0 +1 @@ +export * from "./modal"; diff --git a/web/ee/components/estimates/update/modal.tsx b/web/ee/components/estimates/update/modal.tsx new file mode 100644 index 000000000..5c7d0b725 --- /dev/null +++ b/web/ee/components/estimates/update/modal.tsx @@ -0,0 +1 @@ +export * from "ce/components/estimates/update/modal"; diff --git a/web/ee/constants/estimates.ts b/web/ee/constants/estimates.ts index 654243fa1..06376ef9d 100644 --- a/web/ee/constants/estimates.ts +++ b/web/ee/constants/estimates.ts @@ -1,3 +1 @@ -import * as ceConstants from "@/plane-web/constants/estimates"; - -export { ceConstants }; +export * from "ce/constants/estimates";