mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
[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:
parent
ee4ad580fc
commit
52617baf0e
@ -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<TEstimateListItem> = observer((props) => {
|
||||
const { estimateId, isAdmin, isEditable, onEditClick, onDeleteClick } = props;
|
||||
if (!isAdmin || !isEditable) return <></>;
|
||||
const { estimateId, isAdmin, isEditable, onDeleteClick } = props;
|
||||
|
||||
if (!isAdmin || !isEditable) return <></>;
|
||||
return (
|
||||
<div className="relative flex items-center gap-1">
|
||||
<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={() => onEditClick && onEditClick(estimateId)}
|
||||
<Tooltip
|
||||
tooltipContent={
|
||||
<div className="relative flex items-center gap-2">
|
||||
<div>Upgrade</div>
|
||||
<Crown size={12} className="text-amber-400" />
|
||||
</div>
|
||||
}
|
||||
position="top"
|
||||
>
|
||||
<Pen size={12} />
|
||||
</button>
|
||||
<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)}
|
3
web/ce/components/estimates/index.ts
Normal file
3
web/ce/components/estimates/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from "./estimate-list-item-buttons";
|
||||
|
||||
export * from "./update";
|
1
web/ce/components/estimates/update/index.ts
Normal file
1
web/ce/components/estimates/update/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./modal";
|
14
web/ce/components/estimates/update/modal.tsx
Normal file
14
web/ce/components/estimates/update/modal.tsx
Normal 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(() => <></>);
|
@ -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: {
|
||||
@ -119,18 +121,3 @@ export const ESTIMATE_SYSTEMS: TEstimateSystems = {
|
||||
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,
|
||||
},
|
||||
];
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -4,7 +4,8 @@ import { observer } from "mobx-react";
|
||||
import { cn } from "@/helpers/common.helper";
|
||||
// hooks
|
||||
import { useEstimate, useProjectEstimates } from "@/hooks/store";
|
||||
import { EstimateListItemButtons } from "./estimate-list-item-buttons";
|
||||
// plane web components
|
||||
import { EstimateListItemButtons } from "@/plane-web/components/estimates";
|
||||
|
||||
type TEstimateListItem = {
|
||||
estimateId: string;
|
||||
|
@ -10,14 +10,10 @@ export * from "./estimate-disable-switch";
|
||||
// estimates
|
||||
export * from "./estimate-list";
|
||||
export * from "./estimate-list-item";
|
||||
export * from "./estimate-list-item-buttons";
|
||||
|
||||
// create
|
||||
export * from "./create";
|
||||
|
||||
// update
|
||||
export * from "./update";
|
||||
|
||||
// delete
|
||||
export * from "./delete";
|
||||
|
||||
|
@ -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 { 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>
|
||||
|
@ -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;
|
||||
|
@ -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 { estimateCount } from "@/plane-web/constants/estimates";
|
||||
|
||||
type TEstimatePointItemPreview = {
|
||||
workspaceSlug: string;
|
||||
@ -61,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={() =>
|
||||
|
@ -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;
|
||||
|
@ -7,12 +7,13 @@ import {
|
||||
EstimateEmptyScreen,
|
||||
EstimateDisableSwitch,
|
||||
CreateEstimateModal,
|
||||
UpdateEstimateModal,
|
||||
DeleteEstimateModal,
|
||||
EstimateList,
|
||||
} from "@/components/estimates";
|
||||
// hooks
|
||||
import { useProject, useProjectEstimates } from "@/hooks/store";
|
||||
// plane web components
|
||||
import { UpdateEstimateModal } from "@/plane-web/components/estimates";
|
||||
|
||||
type TEstimateRoot = {
|
||||
workspaceSlug: string;
|
||||
|
@ -1,2 +0,0 @@
|
||||
export * from "./modal";
|
||||
export * from "./stage-one";
|
@ -1,44 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { FC } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Button } from "@plane/ui";
|
||||
// components
|
||||
import { EModalPosition, EModalWidth, ModalCore } from "@/components/core";
|
||||
import { EstimateUpdateStageOne } from "@/components/estimates";
|
||||
|
||||
type TUpdateEstimateModal = {
|
||||
workspaceSlug: string;
|
||||
projectId: string;
|
||||
estimateId: string | undefined;
|
||||
isOpen: boolean;
|
||||
handleClose: () => void;
|
||||
};
|
||||
|
||||
export const UpdateEstimateModal: FC<TUpdateEstimateModal> = observer((props) => {
|
||||
// props
|
||||
const { isOpen, handleClose } = props;
|
||||
|
||||
return (
|
||||
<ModalCore isOpen={isOpen} position={EModalPosition.TOP} width={EModalWidth.XXL}>
|
||||
<div className="relative space-y-6 py-5">
|
||||
{/* heading */}
|
||||
<div className="relative flex justify-between items-center gap-2 px-5">
|
||||
<div className="relative flex items-center gap-1">
|
||||
<div className="text-xl font-medium text-custom-text-200">Edit estimate system</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-5">
|
||||
<EstimateUpdateStageOne />
|
||||
</div>
|
||||
|
||||
<div className="relative flex justify-end items-center gap-3 px-5 pt-5 border-t border-custom-border-200">
|
||||
<Button variant="neutral-primary" size="sm" onClick={handleClose}>
|
||||
Cancel
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCore>
|
||||
);
|
||||
});
|
@ -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";
|
||||
// constants
|
||||
import { ESTIMATE_OPTIONS_STAGE_ONE } from "@/constants/estimates";
|
||||
// helpers
|
||||
import { cn } from "@/helpers/common.helper";
|
||||
|
||||
type TEstimateUpdateStageOne = {
|
||||
handleEstimateEditType?: (stage: TEstimateUpdateStageKeys) => void;
|
||||
};
|
||||
|
||||
export const EstimateUpdateStageOne: FC<TEstimateUpdateStageOne> = (props) => {
|
||||
const { handleEstimateEditType } = props;
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{ESTIMATE_OPTIONS_STAGE_ONE &&
|
||||
ESTIMATE_OPTIONS_STAGE_ONE.map((stage) => (
|
||||
<div
|
||||
key={stage.key}
|
||||
className={cn(
|
||||
"border border-custom-border-300 cursor-pointer space-y-1 p-3 rounded transition-colors",
|
||||
stage?.is_ee ? `bg-custom-background-90` : `hover:bg-custom-background-90`
|
||||
)}
|
||||
onClick={() => !stage?.is_ee && handleEstimateEditType && handleEstimateEditType(stage.key)}
|
||||
>
|
||||
<h3 className="text-base font-medium relative flex items-center gap-2">
|
||||
{stage.title}
|
||||
{stage?.is_ee && (
|
||||
<Tooltip tooltipContent={"upgrade"}>
|
||||
<Crown size={12} className="text-amber-400" />
|
||||
</Tooltip>
|
||||
)}
|
||||
</h3>
|
||||
<p className="text-sm text-custom-text-200">{stage.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
@ -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;
|
||||
|
@ -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: "",
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -0,0 +1 @@
|
||||
export * from "ce/components/estimates/estimate-list-item-buttons";
|
1
web/ee/components/estimates/index.ts
Normal file
1
web/ee/components/estimates/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./estimate-list-item-buttons";
|
1
web/ee/components/estimates/update/index.ts
Normal file
1
web/ee/components/estimates/update/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./modal";
|
1
web/ee/components/estimates/update/modal.tsx
Normal file
1
web/ee/components/estimates/update/modal.tsx
Normal file
@ -0,0 +1 @@
|
||||
export * from "ce/components/estimates/update/modal";
|
1
web/ee/constants/estimates.ts
Normal file
1
web/ee/constants/estimates.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "ce/constants/estimates";
|
@ -1,4 +1,5 @@
|
||||
import { EEstimateSystem } from "@/constants/estimates";
|
||||
// plane web constants
|
||||
import { EEstimateSystem } from "@/plane-web/constants/estimates";
|
||||
|
||||
export const isEstimatePointValuesRepeated = (
|
||||
estimatePoints: string[],
|
||||
|
Loading…
Reference in New Issue
Block a user