dv: seperating constants for ce and ee

This commit is contained in:
gurusainath 2024-06-13 14:14:26 +05:30
parent 34e1be7ba0
commit edbc707199
16 changed files with 166 additions and 23 deletions

View File

@ -0,0 +1,136 @@
// 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 minEstimatesCount = 2;
export const maxEstimatesCount = 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,
},
];

View File

@ -5,9 +5,10 @@ import { TYAxisValues } from "@plane/types";
import { CustomSelect } from "@plane/ui";
// constants
import { ANALYTICS_Y_AXIS_VALUES } from "@/constants/analytics";
import { EEstimateSystem } from "@/constants/estimates";
// hooks
import { useAppRouter, useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type Props = {
value: TYAxisValues;

View File

@ -13,12 +13,13 @@ import { CustomSelect, Spinner } from "@plane/ui";
import ProgressChart from "@/components/core/sidebar/progress-chart";
import { CycleProgressStats } from "@/components/cycles";
// constants
import { EEstimateSystem } from "@/constants/estimates";
import { EIssueFilterType, EIssuesStoreType } from "@/constants/issue";
// helpers
import { getDate } from "@/helpers/date-time.helper";
// hooks
import { useIssues, useCycle, useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type TCycleAnalyticsProgress = {
workspaceSlug: string;

View File

@ -16,7 +16,6 @@ import { ArchiveCycleModal, CycleDeleteModal, CycleAnalyticsProgress } from "@/c
import { DateRangeDropdown } from "@/components/dropdowns";
// constants
import { CYCLE_STATUS } from "@/constants/cycle";
import { EEstimateSystem } from "@/constants/estimates";
import { CYCLE_UPDATED } from "@/constants/event-tracker";
import { EUserWorkspaceRoles } from "@/constants/workspace";
// helpers
@ -24,6 +23,8 @@ import { findHowManyDaysLeft, getDate, renderFormattedPayloadDate } from "@/help
import { copyUrlToClipboard } from "@/helpers/string.helper";
// hooks
import { useEventTracker, useCycle, useUser, useMember, useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
// services
import { CycleService } from "@/services/cycle.service";

View File

@ -8,10 +8,10 @@ import { Button, TOAST_TYPE, setToast } from "@plane/ui";
// components
import { EModalPosition, EModalWidth, ModalCore } from "@/components/core";
import { EstimateCreateStageOne, EstimatePointCreateRoot } from "@/components/estimates";
// constants
import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@/constants/estimates";
// hooks
import { useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem, ESTIMATE_SYSTEMS } from "@/plane-web/constants/estimates";
type TCreateEstimateModal = {
workspaceSlug: string;

View File

@ -6,8 +6,8 @@ import { TEstimateSystemKeys } from "@plane/types";
import { Tooltip } from "@plane/ui";
// components
import { RadioInput } from "@/components/estimates";
// constants
import { ESTIMATE_SYSTEMS } from "@/constants/estimates";
// plane web constants
import { ESTIMATE_SYSTEMS } from "@/plane-web/constants/estimates";
type TEstimateCreateStageOne = {
estimateSystem: TEstimateSystemKeys;

View File

@ -7,8 +7,8 @@ import { TEstimatePointsObject, TEstimateSystemKeys } from "@plane/types";
import { Button, Sortable } from "@plane/ui";
// components
import { EstimatePointCreate, EstimatePointItemPreview } from "@/components/estimates/points";
// constants
import { maxEstimatesCount } from "@/constants/estimates";
// plane web constants
import { maxEstimatesCount } from "@/plane-web/constants/estimates";
type TEstimatePointCreateRoot = {
workspaceSlug: string;

View File

@ -5,13 +5,13 @@ import { observer } from "mobx-react";
import { Check, Info, X } from "lucide-react";
import { TEstimatePointsObject, TEstimateSystemKeys } from "@plane/types";
import { Spinner, TOAST_TYPE, Tooltip, setToast } from "@plane/ui";
// constants
import { EEstimateSystem } from "@/constants/estimates";
// helpers
import { cn } from "@/helpers/common.helper";
import { isEstimatePointValuesRepeated } from "@/helpers/estimates";
// hooks
import { useEstimate } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type TEstimatePointCreate = {
workspaceSlug: string;

View File

@ -4,7 +4,8 @@ import { GripVertical, Pencil, Trash2 } from "lucide-react";
import { TEstimatePointsObject, TEstimateSystemKeys } from "@plane/types";
// components
import { EstimatePointUpdate, EstimatePointDelete } from "@/components/estimates/points";
import { minEstimatesCount } from "@/constants/estimates";
// plane web constants
import { minEstimatesCount } from "@/plane-web/constants/estimates";
type TEstimatePointItemPreview = {
workspaceSlug: string;

View File

@ -5,13 +5,13 @@ import { observer } from "mobx-react";
import { Check, Info, X } from "lucide-react";
import { TEstimatePointsObject, TEstimateSystemKeys } from "@plane/types";
import { Spinner, TOAST_TYPE, Tooltip, setToast } from "@plane/ui";
// constants
import { EEstimateSystem } from "@/constants/estimates";
// helpers
import { cn } from "@/helpers/common.helper";
import { isEstimatePointValuesRepeated } from "@/helpers/estimates";
// hooks
import { useEstimatePoint } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type TEstimatePointUpdate = {
workspaceSlug: string;

View File

@ -4,10 +4,10 @@ import { FC } from "react";
import { Crown } from "lucide-react";
import { TEstimateUpdateStageKeys } from "@plane/types";
import { Tooltip } from "@plane/ui";
// constants
import { ESTIMATE_OPTIONS_STAGE_ONE } from "@/constants/estimates";
// 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;

View File

@ -12,12 +12,13 @@ import { CustomSelect, Spinner } from "@plane/ui";
import ProgressChart from "@/components/core/sidebar/progress-chart";
import { ModuleProgressStats } from "@/components/modules";
// constants
import { EEstimateSystem } from "@/constants/estimates";
import { EIssueFilterType, EIssuesStoreType } from "@/constants/issue";
// helpers
import { getDate } from "@/helpers/date-time.helper";
// hooks
import { useIssues, useModule, useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type TModuleAnalyticsProgress = {
workspaceSlug: string;

View File

@ -34,8 +34,6 @@ import {
import { LinkModal, LinksList } from "@/components/core";
import { DateRangeDropdown, MemberDropdown } from "@/components/dropdowns";
import { ArchiveModuleModal, DeleteModuleModal, ModuleAnalyticsProgress } from "@/components/modules";
// constant
import { EEstimateSystem } from "@/constants/estimates";
import {
MODULE_LINK_CREATED,
MODULE_LINK_DELETED,
@ -49,6 +47,8 @@ import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"
import { copyUrlToClipboard } from "@/helpers/string.helper";
// hooks
import { useModule, useUser, useEventTracker, useProjectEstimates } from "@/hooks/store";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
const defaultValues: Partial<IModule> = {
lead_id: "",

View File

@ -12,7 +12,6 @@ import { FavoriteStar } from "@/components/core";
import { ButtonAvatars } from "@/components/dropdowns/member/avatar";
import { ModuleQuickActions } from "@/components/modules";
// constants
import { EEstimateSystem } from "@/constants/estimates";
import { MODULE_FAVORITED, MODULE_UNFAVORITED } from "@/constants/event-tracker";
import { MODULE_STATUS } from "@/constants/module";
import { EUserProjectRoles } from "@/constants/project";
@ -22,6 +21,8 @@ import { generateQueryParams } from "@/helpers/router.helper";
// hooks
import { useEventTracker, useMember, useModule, useProjectEstimates, useUser } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type Props = {
moduleId: string;

View File

@ -10,13 +10,13 @@ import { CircularProgressIndicator } from "@plane/ui";
// components
import { ListItem } from "@/components/core/list";
import { ModuleListItemAction } from "@/components/modules";
// constants
import { EEstimateSystem } from "@/constants/estimates";
// helpers
import { generateQueryParams } from "@/helpers/router.helper";
// hooks
import { useAppRouter, useModule, useProjectEstimates } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
type Props = {
moduleId: string;

View File

@ -1,4 +1,5 @@
import { EEstimateSystem } from "@/constants/estimates";
// plane web constants
import { EEstimateSystem } from "@/plane-web/constants/estimates";
export const isEstimatePointValuesRepeated = (
estimatePoints: string[],