import { FC, useEffect, useState } from "react"; import { observer } from "mobx-react"; import { ChevronLeft } from "lucide-react"; import { TEstimateUpdateStageKeys } from "@plane/types"; import { Button } from "@plane/ui"; // components import { EModalPosition, EModalWidth, ModalCore } from "@/components/core"; import { EstimateUpdateStageOne, EstimatePointEditRoot, EstimatePointSwitchRoot } from "@/components/estimates"; // constants import { EEstimateUpdateStages } from "@/constants/estimates"; type TUpdateEstimateModal = { workspaceSlug: string; projectId: string; estimateId: string | undefined; isOpen: boolean; handleClose: () => void; }; export const UpdateEstimateModal: FC = observer((props) => { // props const { workspaceSlug, projectId, estimateId, isOpen, handleClose } = props; // states const [estimateEditType, setEstimateEditType] = useState(undefined); useEffect(() => { if (!isOpen) setEstimateEditType(undefined); }, [isOpen]); const handleEstimateEditType = (type: TEstimateUpdateStageKeys) => setEstimateEditType(type); const handleSwitchEstimate = () => {}; return (
{/* heading */}
{estimateEditType && (
setEstimateEditType(undefined)} className="flex-shrink-0 cursor-pointer w-5 h-5 flex justify-center items-center" >
)}
Edit estimate system
{estimateEditType === EEstimateUpdateStages.EDIT && ( )}
{!estimateEditType && } {estimateEditType && estimateId && ( <> {estimateEditType === EEstimateUpdateStages.EDIT && ( )} {estimateEditType === EEstimateUpdateStages.SWITCH && ( )} )}
{[EEstimateUpdateStages.SWITCH, undefined].includes(estimateEditType) && (
{estimateEditType === EEstimateUpdateStages.SWITCH && ( )}
)}
); });