import React from 'react'; import {isPlainClick} from '../events'; import ActionsMenu from './ActionsMenu'; import PlantingChip from './PlantingChip'; import PlantingRow from './PlantingRow'; // One garden: its name and actions menu (top right), a picture, then what is // planted, as perennials (just names) and annuals (each with its progress). // Matches gardens/_card. export default function GardenCard({garden, defaultIconUrl, onPlant, highlightedId, highlightKind, onPlantingUpdated, onEditPlanting, onHarvestPlanting, onSaveSeedsPlanting, onAddPhoto, onFinishPlanting, onEditGarden}) { const {id, name, url, image_url: imageUrl, owner, actions, plant_url: plantUrl, perennials, annuals} = garden; const empty = perennials.length === 0 && annuals.length === 0; // What each planting's menu items open, for annuals and perennials alike. const handlers = { edit: onEditPlanting, harvest: onHarvestPlanting, seeds: onSaveSeedsPlanting, finish: onFinishPlanting, photo: onAddPhoto && ((planting, action) => onAddPhoto({label: planting.crop.name, href: action.href})), }; function plant(event) { if (onPlant && isPlainClick(event)) { event.preventDefault(); onPlant(garden); } } return (

{name}

{owner &&
owner: {owner.login_name}
}
{plantUrl && (