import { FC, useState } from "react"; import { observer } from "mobx-react"; import useSWR from "swr"; import { IEstimate } from "@plane/types"; // components import { EstimateLoaderScreen, EstimateEmptyScreen, EstimateDisableSwitch, CreateEstimateModal, EstimateList, } from "@/components/estimates"; // hooks import { useProjectEstimates } from "@/hooks/store"; type TEstimateRoot = { workspaceSlug: string; projectId: string; isAdmin: boolean; }; export const EstimateRoot: FC = observer((props) => { const { workspaceSlug, projectId, isAdmin } = props; // hooks const { loader, currentActiveEstimateId, estimateById, archivedEstimateIds, getProjectEstimates } = useProjectEstimates(); // states const [isEstimateCreateModalOpen, setIsEstimateCreateModalOpen] = useState(false); // const [isEstimateDeleteModalOpen, setIsEstimateDeleteModalOpen] = useState(null); const [estimateToUpdate, setEstimateToUpdate] = useState(); const { isLoading: isSWRLoading } = useSWR( workspaceSlug && projectId ? `PROJECT_ESTIMATES_${workspaceSlug}_${projectId}` : null, async () => workspaceSlug && projectId && getProjectEstimates(workspaceSlug, projectId) ); const onEditClick = (estimateId: string) => { const currentEstimate = estimateById(estimateId); setEstimateToUpdate(currentEstimate); setIsEstimateCreateModalOpen(true); }; return (
{/* {}} /> */} {loader === "init-loader" || isSWRLoading ? ( ) : (
{/* header */}
Estimates
{currentActiveEstimateId ? (
{/* estimates activated deactivated section */}

Enable estimates for my project

They help you in communicating complexity and workload of the team.

{/* active estimates section */}
) : ( setIsEstimateCreateModalOpen(true)} /> )} {/* archived estimates section */} {archivedEstimateIds && archivedEstimateIds.length > 0 && (

Archived estimates

Estimates have gone through a change, these are the estimates you had in your older versions which were not in use. Read more about them  here.

)}
)} {/* modals for create and update */} { setIsEstimateCreateModalOpen(false); setEstimateToUpdate(undefined); }} /> {/* setIsEstimateDeleteModalOpen(null)} data={} /> */}
); });