import { FC } from "react"; import sortBy from "lodash/sortBy"; import { observer } from "mobx-react"; import { Pen } from "lucide-react"; // helpers import { cn } from "@/helpers/common.helper"; // hooks import { useProjectEstimates } from "@/hooks/store"; type TEstimateListItem = { estimateId: string; isAdmin: boolean; isEditable: boolean; onEditClick?: (estimateId: string) => void; }; export const EstimateListItem: FC = observer((props) => { const { estimateId, isAdmin, isEditable, onEditClick } = props; // hooks const { estimateById } = useProjectEstimates(); const currentEstimate = estimateById(estimateId); if (!currentEstimate) return <>; return (

{currentEstimate?.name}

{sortBy(currentEstimate?.points, ["key"]) ?.map((estimatePoint) => estimatePoint?.value) .join(", ")}

{isAdmin && isEditable && (
onEditClick && onEditClick(estimateId)} >
)}
); });