import React, {useState} from 'react'; import ChipToggle from './ChipToggle'; // What the member has growing, or just what is ready to pick, as a table. The // chips switch between the two without reloading. `growing` and `ready` are // the rows to show, already worded by Rails; `chips` are the // chip labels, with the full totals in them. export default function GrowingTable({growing, ready, chips, initial, labels}) { const [shown, setShown] = useState(initial); const rows = shown === 'ready' ? ready : growing; const options = [ {key: 'growing', label: chips.growing, href: '/'}, {key: 'ready', label: chips.ready, href: '/?show=ready'} ]; return ( <>
{rows.length === 0 && ( )} {rows.map((row) => ( ))}
{labels.col_plant} {labels.col_bed} {labels.col_planted} {labels.col_maturity} {labels.col_progress}
{labels.nothing_ready}
{row.name} {row.garden} {row.planted} {row.maturity}
); }