feat(signage): menu look part by part, board-only names, stack bar, Delete key (owner review 3)

- Menus (slides and widgets): headings / names / prices each with size,
  colour, font, bold / italic / underline and alignment; dots size, colour
  and style; line and letter spacing; photo size and shape (menuLook)
- Names aligned right end together, prices in a page-wide column
- Names for one board only (names, category_names) with a pencil on the
  board's list; the catalogue name stays for the waiters
- Fixed: menu lists inherited the page's fixed line height (big text
  overlapped); a menu slide's list grew past the screen (no 2nd column)
- Stacks: parts sized by dragging the lines on the bar; "Add a widget"
- Delete / Backspace removes the picked widget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 10:51:03 +02:00
co-authored by Claude Opus 5.5
parent 1b993e4573
commit e8c8ec825e
16 changed files with 642 additions and 81 deletions
@@ -5,7 +5,8 @@
// position and size "custom" and its own box (% of the slide), which the TV draws the same.
// It lies over SlidePreview's box and finds each widget by its `data-widget` (@xenia/signage).
// Owner review 2 (2026-11-21): the arrow keys move the picked widget wherever it was picked (here
// or on its card below), unless you are typing or using a control that takes the arrows itself.
// or on its card below), unless you are typing or using a control that takes the arrows itself;
// Delete (or Backspace) removes it (owner review 3; "Undo changes" brings it back).
import { useEffect, useLayoutEffect, useRef, useState } from 'react'
import { useTranslation } from '@xenia/i18n'
import { boxFromRect, moveBox, resizeBox, snapBox } from './signageLogic'
@@ -16,7 +17,7 @@ const SIZE = 14 // a handle, px
// where the arrow keys belong to the control (typing, lists, sliders, choices)
const OWN_KEYS = 'input, textarea, select, [contenteditable="true"], [role="slider"], [role="radio"], [role="option"], [role="listbox"], [role="combobox"], [role="menu"], [role="menuitem"], [role="tab"], [role="spinbutton"], [role="dialog"] *'
export default function WidgetCanvas({ boxRef, widgets, selected, onSelect, onPlace, label }) {
export default function WidgetCanvas({ boxRef, widgets, selected, onSelect, onPlace, onRemove, label }) {
const { t } = useTranslation('manager')
const [rects, setRects] = useState({})
const [guides, setGuides] = useState([])
@@ -76,6 +77,7 @@ export default function WidgetCanvas({ boxRef, widgets, selected, onSelect, onPl
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return
if (e.target instanceof Element && e.target.closest(OWN_KEYS)) return
if (e.key === 'Escape') { onSelect(null); return }
if ((e.key === 'Delete' || e.key === 'Backspace') && onRemove) { e.preventDefault(); onRemove(selected); return }
const step = e.shiftKey ? 2 : 0.5
const d = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, -step], ArrowDown: [0, step] }[e.key]
if (!d) return
@@ -86,7 +88,7 @@ export default function WidgetCanvas({ boxRef, widgets, selected, onSelect, onPl
}
window.addEventListener('keydown', on)
return () => window.removeEventListener('keydown', on)
}, [selected, widgets, rects, onPlace, onSelect])
}, [selected, widgets, rects, onPlace, onSelect, onRemove])
const sel = selected != null ? (widgets[selected]?.position === 'custom' && widgets[selected].box) || rects[selected] : null
return (