import { FC, useState } from "react"; import { observer } from "mobx-react"; import useSWR from "swr"; // components import { EstimateLoaderScreen, EstimateEmptyScreen, EstimateDisableSwitch, CreateEstimateModal, 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; projectId: string; isAdmin: boolean; }; export const EstimateRoot: FC = observer((props) => { const { workspaceSlug, projectId, isAdmin } = props; // hooks const { currentProjectDetails } = useProject(); const { loader, currentActiveEstimateId, archivedEstimateIds, getProjectEstimates } = useProjectEstimates(); // states const [isEstimateCreateModalOpen, setIsEstimateCreateModalOpen] = useState(false); const [estimateToUpdate, setEstimateToUpdate] = useState(); const [estimateToDelete, setEstimateToDelete] = useState(); const { isLoading: isSWRLoading } = useSWR( workspaceSlug && projectId ? `PROJECT_ESTIMATES_${workspaceSlug}_${projectId}` : null, async () => workspaceSlug && projectId && getProjectEstimates(workspaceSlug, projectId) ); return (
{loader === "init-loader" || isSWRLoading ? ( ) : (
{/* header */}
Estimates
{/* current active estimate section */} {currentActiveEstimateId ? (
{/* estimates activated deactivated section */}

Enable estimates for my project

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

{/* active estimates section */} setEstimateToUpdate(estimateId)} onDeleteClick={(estimateId: string) => setEstimateToDelete(estimateId)} />
) : ( 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.

)}
)} {/* CRUD modals */} setIsEstimateCreateModalOpen(false)} /> setEstimateToUpdate(undefined)} /> setEstimateToDelete(undefined)} />
); });