import React from 'react'; import {isPlainClick} from '../events'; import ActionsMenu from './ActionsMenu'; import CropChip from './CropChip'; import PlantedDate from './PlantedDate'; // One annual planting as a row of three aligned columns: the crop (and when it // was planted), how it is getting on (badges, then a progress bar or a note // when there is nothing to predict from), and its own actions menu. export default function PlantingRow({planting, defaultIconUrl, highlighted, onUpdated, onEdit}) { const {id, url, crop, badges} = planting; return (
{badges.length > 0 && (
{badges.map((badge) => ( {badge.label} ))}
)} {planting.progress_note ? ( {planting.progress_note} ) : ( )}
); } function Progress({percentage, state, finishLabel}) { if (percentage === null || percentage === undefined) return null; return (
{Math.round(percentage)}% {finishLabel && {finishLabel}}
); }