// A menu's look, part by part (owner review 3, 2026-11-21), for menu slides and menu widgets alike: // one row each for the headings, the product names and the prices (size, colour, font, bold / // italic / underline, alignment), the dots between name and price (size, colour, style), and the // spacing (line and letter spacing: empty = auto) with the photos' size and shape and the accent // (badges, page dots). The names' row sets the board's own text size, colour and font; headings and // prices follow them (the accent colour) until given their own. The player draws it (menuLook). import { AlignCenter, AlignLeft, AlignRight, Bold, Italic, Underline } from 'lucide-react' import { useTranslation } from '@xenia/i18n' import { Dropdown, Field, Input, Segmented } from '@xenia/ui' import { FONT_KEYS, MENU_COLOURS } from './signageLogic' import { ColourField, Range, Section } from './SignageFields' const ROW = 'grid gap-3 items-end grid-cols-2 lg:grid-cols-[7rem_repeat(5,minmax(0,1fr))]' export default function MenuLook({ c, setC }) { const { t } = useTranslation('manager') const base = c.text_size || 100 const accent = c.accent_colour || MENU_COLOURS.accent const style = key => c[key] || {} const setStyle = (key, patch) => setC({ [key]: { ...style(key), ...patch } }) const fontOptions = inherit => [...(inherit ? [{ value: '', label: t('signage.look.sameFont') }] : []), ...FONT_KEYS.map(x => ({ value: x, label: t(`signage.fonts.${x}`) }))] const num = (v, lo, hi) => { const n = Number(String(v).replace(',', '.')) return v === '' || Number.isNaN(n) ? null : Math.min(hi, Math.max(lo, n)) } /** A row for headings / names / prices: size, colour, font, style, alignment. */ const partRow = (key, label, { size, colour, font, onSize, onColour, onFont, inherit, align }) => { const s = style(key) return (
{label} setStyle(key, patch)} testid={`signage-look-${key}`} /> setStyle(key, { align: v })} fill data-testid={`signage-look-${key}-align`} options={[['left', AlignLeft], ['center', AlignCenter], ['right', AlignRight]].map(([v, Icon]) => ( { value: v, icon:
) } const d = style('dot_style') return (
{partRow('heading_style', t('signage.look.headings'), { size: style('heading_style').size || base, onSize: v => setStyle('heading_style', { size: v }), colour: style('heading_style').colour || accent, onColour: v => setStyle('heading_style', { colour: v }), font: style('heading_style').font || '', onFont: v => setStyle('heading_style', { font: v || null }), inherit: true, align: c.board_align || 'left', })} {partRow('item_style', t('signage.look.names'), { size: base, onSize: v => setC({ text_size: v }), colour: c.text_colour || MENU_COLOURS.text, onColour: v => setC({ text_colour: v }), font: c.font || 'sans', onFont: v => setC({ font: v }), inherit: false, align: 'left', })} {partRow('price_style', t('signage.look.prices'), { size: style('price_style').size || base, onSize: v => setStyle('price_style', { size: v }), colour: style('price_style').colour || accent, onColour: v => setStyle('price_style', { colour: v }), font: style('price_style').font || '', onFont: v => setStyle('price_style', { font: v || null }), inherit: true, align: 'right', })}
{t('signage.look.dots')} setStyle('dot_style', { size: v })} testid="signage-look-dots-size" /> setStyle('dot_style', { colour: v })} testid="signage-look-dots-colour" /> setStyle('dot_style', { style: v })} data-testid="signage-look-dots-style" options={['dotted', 'dashed', 'solid', 'none'].map(x => ({ value: x, label: t(`signage.look.dotStyles.${x}`) }))} />
{t('signage.look.spacing')} setC({ line_height: num(e.target.value, 0.8, 3) })} /> setC({ letter_spacing: num(e.target.value, -0.1, 0.5) })} /> {c.show_photos ? <> setC({ photo_size: v })} testid="signage-look-photo-size" /> setC({ photo_shape: v })} data-testid="signage-look-photo-shape" options={['square', 'rounded', 'round'].map(x => ({ value: x, label: t(`signage.look.shapes.${x}`) }))} /> : <>} setC({ accent_colour: v })} testid="signage-accent" />

{t('signage.look.hint')}

) } function RowLabel({ children }) { return {children} } /** Bold, italic, underline: three toggles as tall as a field. */ function TextToggles({ s, onChange, testid }) { const { t } = useTranslation('manager') const items = [['bold', Bold, s.bold !== false], ['italic', Italic, !!s.italic], ['underline', Underline, !!s.underline]] return (
{items.map(([k, Icon, on]) => ( ))}
) }