// The kitchen screen's settings (plan steps 3.2a, 3.2b): device config (GET /api/devices/me → // config, the same as GET /api/kds/context → settings; modules/kds/manifest.py) → what the // board uses. Pure. export const FONT_SCALE_MIN = 60 export const FONT_SCALE_MAX = 200 export const FONT_SCALE_STEP = 10 export const DEFAULT_CONFIG = { prep_zone_id: null, card_width: 272, font_scale: 100, font_weight: 600, batch_mode: 'merged', group_items: 'off', group_by_course: false, combine_modifiers: false, categories_as_filters: true, age_warning_minutes: 5, age_late_minutes: 10, age_flash_minutes: 15, flash_late: true, colour_fresh: '#34b56a', colour_warning: '#f0a52a', colour_late: '#e8513f', colour_done: '#3d4757', triple_state: false, sound: true, notify_order_complete: false, notify_item_complete: false, refresh_seconds: 30, auto_sign_out_minutes: 0, } /** Device config → board settings. `fontScale` (percent) overrides font_scale for this * session (the top bar's zoom buttons). */ export function boardSettings(config, fontScale = null) { const c = { ...DEFAULT_CONFIG, ...(config || {}) } return { zoneId: c.prep_zone_id, colW: c.card_width, fontScale: (fontScale ?? c.font_scale) / 100, fontWeight: c.font_weight, batchMode: c.batch_mode, groupItems: c.group_items, groupByCourse: c.group_by_course, combineModifiers: c.combine_modifiers, categoriesAsFilters: c.categories_as_filters, thresholds: { warning: c.age_warning_minutes, late: c.age_late_minutes, flash: c.age_flash_minutes }, flashLate: c.flash_late, colours: { fresh: c.colour_fresh, warning: c.colour_warning, late: c.colour_late, done: c.colour_done }, tripleState: c.triple_state, sound: c.sound, notifyOrderComplete: c.notify_order_complete, notifyItemComplete: c.notify_item_complete, refreshSeconds: c.refresh_seconds, } } /** The zoom buttons: one step, kept within the allowed range. */ export function zoomStep(percent, dir) { return Math.min(FONT_SCALE_MAX, Math.max(FONT_SCALE_MIN, percent + dir * FONT_SCALE_STEP)) } /** How the screen signs its calls to waiters (the backend does the same, routers/kds.py). */ export function senderName(context) { const z = context?.zone return (z && (z.notification_name || z.name)) || context?.device?.name || '' }