mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: updated estimate structure for ce and ee
This commit is contained in:
parent
362731ad2a
commit
d8df1022d2
@ -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"
|
||||
>
|
||||
<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(() => <></>);
|
@ -121,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,
|
||||
},
|
||||
];
|
||||
|
@ -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,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";
|
||||
// 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<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>
|
||||
);
|
||||
};
|
@ -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,
|
||||
},
|
||||
];
|
@ -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,3 +1 @@
|
||||
import * as ceConstants from "@/plane-web/constants/estimates";
|
||||
|
||||
export { ceConstants };
|
||||
export * from "ce/constants/estimates";
|
||||
|
Loading…
Reference in New Issue
Block a user