Files
Brenda WallaceandClaude Sonnet 5.5 b7dbb84ebd Add a garden and plant from the home page without leaving it
The garden dialog now adds a garden as well as edits one (new.json and
create.json on GardensController), and a GardenPicker button opens it from the
home page. A plant_picker helper replaces the home page's separate plant
links and the plant_button partial. The plant dialog asks when it was
planted (Today, Yesterday, Enter date), using a WhenPicker shared with the
harvest dialog. Members with no garden still get the full-page plant link.

Part of #4933

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 22:21:26 +13:00

19 lines
646 B
React

import React, {useState} from 'react';
import GardenFormModal from './GardenFormModal';
import PickerButton from './PickerButton';
// A button that opens the new-garden dialog, for pages that are not a list of
// garden cards, like the home page. Once saved the page reloads, so it shows
// the new garden.
export default function GardenPicker({label, buttonClass}) {
const [open, setOpen] = useState(false);
return (
<>
<PickerButton label={label} className={buttonClass} onClick={() => setOpen(true)} />
{open && <GardenFormModal onClose={() => setOpen(false)} onSaved={() => window.location.reload()} />}
</>
);
}