mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-29 10:18:29 -04:00
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>
19 lines
646 B
React
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()} />}
|
|
</>
|
|
);
|
|
}
|