mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-09-25 07:24:55 -04:00
Clicking a chip opens the planting's menu under it (view, edit, add photo, record harvest, save seeds, mark as finished), in place of the three dots on annual rows, so perennials get the same menu. A caret shows the chip opens something. Someone who can't change the planting still gets a plain link chip. The menu items are lowercase for every planting menu. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
16 lines
547 B
JavaScript
16 lines
547 B
JavaScript
import {isPlainClick} from './events';
|
|
|
|
// What a click on one of a planting's menu items does: if there is a dialog for
|
|
// that item (handlers is keyed by the action's key: edit, harvest, seeds, photo,
|
|
// finish) it opens it, over the list; anything else, and ctrl/cmd-click, follows
|
|
// the link as usual.
|
|
export function selectPlantingAction(planting, handlers) {
|
|
return (action, event) => {
|
|
const open = handlers[action.key];
|
|
if (open && isPlainClick(event)) {
|
|
event.preventDefault();
|
|
open(planting, action);
|
|
}
|
|
};
|
|
}
|