import React from 'react'; import ActionsMenu from './ActionsMenu'; import CropChip from './CropChip'; import PlantingRow from './PlantingRow'; // A plain left click, as opposed to ctrl/cmd/shift/middle click, which should still open the link normally. function isPlainClick(event) { return event.button === 0 && !(event.metaKey || event.ctrlKey || event.shiftKey || event.altKey); } // 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}) { const {id, name, url, image_url: imageUrl, owner, actions, perennials, annuals} = garden; const empty = perennials.length === 0 && annuals.length === 0; return (

{name}

{owner &&
owner: {owner.login_name}
}
{ if (action.key === 'plant' && onPlant && isPlainClick(event)) { event.preventDefault(); onPlant(garden); } }} />
{name}
{empty ? (

Nothing planted here yet.

) : ( <>

Perennials

{perennials.length > 0 ? (
{perennials.map((planting) => ( ))}
) : (

None

)}

Annuals

{annuals.length > 0 ? (
{annuals.map((planting) => ( ))}
) : (

None

)}
)}
); }