import { FC } from "react"; import { observer } from "mobx-react"; // helpers import { cn } from "@/helpers/common.helper"; // hooks import { useEstimate, useProjectEstimates } from "@/hooks/store"; import { EstimateListItemButtons } from "./estimate-list-item-buttons"; type TEstimateListItem = { estimateId: string; isAdmin: boolean; isEstimateEnabled: boolean; isEditable: boolean; onEditClick?: (estimateId: string) => void; onDeleteClick?: (estimateId: string) => void; }; export const EstimateListItem: FC = observer((props) => { const { estimateId, isAdmin, isEstimateEnabled, isEditable } = props; // hooks const { estimateById } = useProjectEstimates(); const { estimatePointIds, estimatePointById } = useEstimate(estimateId); const currentEstimate = estimateById(estimateId); // derived values const estimatePointValues = estimatePointIds?.map((estimatePointId) => { const estimatePoint = estimatePointById(estimatePointId); if (estimatePoint) return estimatePoint.value; }); if (!currentEstimate) return <>; return (

{currentEstimate?.name}

{(estimatePointValues || [])?.join(", ")}

); });