Files
growstuff/app/javascript/plantingActions.js
T
Brenda WallaceandClaude Sonnet 5 eb18622b78 Make the crop chip the planting's menu, for annuals and perennials
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>
2026-09-22 17:42:26 +12:00

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);
}
};
}