feat(manager): design pass 1 — every page on <Page>, shared toolbars, fees under Online orders, QR codes under Tables, day stats reworked

From the owner's page-by-page review (2026-11-20):
- every page root is <Page> (scrolls, fills 1080p, 16:9 centred on
  ultrawides); not yet: products, management/tables, stock (next pass)
- /dashboard: more padding in cards (p-card), quieter secondary text,
  11px uppercase labels everywhere (text-overline)
- day stats: xl dialog, "● Day running · Opened …" as text, the six
  figures in equal boxes, "On tabs" in the payments bar, shared Tabs
- /tables: Segmented List / Map / QR codes (?view=; /online/qr redirects),
  filter chips + zones multi-select at one height, the card itself opens
  the table (button removed), cards ~20% wider
- /online-orders: shared Tabs with Settings (= the old /online/fees page,
  which redirects to ?tab=settings); orders fill the width
- contacts, customers, expenses: PageHeader + Toolbar + SearchInput +
  multi-select Dropdowns (kinds; statuses, categories); table cells
  vertically centred; the Spent tip opens on hover
- filterCards / filterContacts / filterExpenses take several values
  (unit tests added)
- docs/DESIGN.md: the design language (CS-20 in the pack README)
- tests/e2e/manager_layout.mjs: the page rule at 1920x1080 and 3440x1440;
  manager.mjs and manager_look.mjs follow the moved pages

Verified: manager build + lint (0 errors), unit tests (manager 99, ui 24,
i18n 31, api 25, access 8), i18n guard, manager_layout.mjs all passed,
manager.mjs 228 checks all passed. Not checked: the waiter app and the
terminal by eye (they only get the muted ink-2 token).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 11:23:30 +02:00
co-authored by Claude Opus 5.5
parent 26ba19cba5
commit 6f4ab23582
67 changed files with 535 additions and 356 deletions
+7 -4
View File
@@ -518,9 +518,9 @@ try {
ooUrls.some(u => u.startsWith('/api/connect/orders')) && !ooUrls.some(u => u.startsWith('/api/stream')), [...new Set(ooUrls)].filter(u => u.startsWith('/api/')).join(' '))
// ── phase 3S S.3: delivery areas and fees, set up and tested on the real page ──
await page.goto(`${APP}/online/fees`)
r.check('fees: the page opens from the nav entry, no rules yet', await page.getByTestId('fees-page').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
&& await page.locator('a[href="/online/fees"]').count() >= 1 && await page.getByTestId('rule').count() === 0)
await page.goto(`${APP}/online/fees`) // the old address leads to Online orders → Settings (2026-11-20)
r.check('fees: Online orders → Settings opens, no rules yet', await page.getByTestId('fees-page').waitFor({ timeout: 10_000 }).then(() => true).catch(() => false)
&& await page.getByTestId('online-tab-settings').getAttribute('aria-selected') === 'true' && await page.getByTestId('rule').count() === 0)
r.check('ordering link: the venue\'s ordering app address is shown, with its QR code', await page.getByTestId('ordering-link').count() === 1
&& (await page.getByTestId('ordering-link-url').textContent()).endsWith('/order/test-site-1') && await page.getByTestId('ordering-link').locator('svg').count() >= 1)
await page.getByTestId('area-add').click()
@@ -1412,7 +1412,10 @@ try {
const gone = await milkRow.waitFor({ state: 'detached', timeout: 8000 }).then(() => true).catch(() => false)
milk = (await api('GET', '/api/expenses/', { token: boss })).find(e => e.id === milk.id)
r.check(`${fi} the rest paid: it shows paid and leaves the "not fully paid" list`, gone && milk.status === 'paid' && milk.payments.length === 2, JSON.stringify(milk))
await page.getByTestId('expenses-status').selectOption('paid')
// the status filter is the shared multi-select (2026-11-20): add Paid to Due + Partly paid
await page.getByTestId('expenses-status').click()
await page.locator('.x-dropdown__option', { hasText: 'Paid' }).filter({ hasNotText: 'Partly' }).click()
await page.keyboard.press('Escape')
await page.locator('[data-testid="expense-row"]', { hasText: 'E2E milk November' }).click()
r.check(`${fi} the expense opens with its two payments`, await page.getByTestId('expense-view').waitFor({ timeout: 8000 }).then(() => true).catch(() => false)
&& await page.locator('[data-testid="expense-view"] li').count() === 2)
+115
View File
@@ -0,0 +1,115 @@
// The page rule (2026-11-20): every manager page is a <Page> that scrolls on its own, fills a
// 1080p screen and stays at 16:9 width, centred, on an ultrawide. For each page, at 1920×1080
// and 3440×1440: the page body exists, fills the content area (1080p) or is capped and centred
// (ultrawide), and the page scrolls when its content is taller than the screen. Screenshots of a
// few key screens (and the open dropdowns / the day summary) go to out/manager-layout/.
//
// node manager_layout.mjs
//
// Starts its own backend (:8067, demo data) and the manager (:5191).
import { mkdirSync, openSync } from 'node:fs'
import path from 'node:path'
import { spawn } from 'node:child_process'
import { chromium } from 'playwright'
import { BROWSER_CHANNEL, CS, OUT, reporter, sleep } from './lib/env.mjs'
import { killTree, login, startBackend, waitHttp } from './lib/proc.mjs'
const DIR = path.join(OUT, 'manager-layout')
mkdirSync(DIR, { recursive: true })
// pages on <Page> (the rest have their own layout: products, tables set-up, stock placeholder)
const PAGES = [
'dashboard', 'tables', 'tables?view=qr', 'online-orders', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers',
'financials/expenses', 'financials/tabs', 'management/media', 'management/signage', 'management/staff', 'management/sessions',
'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'inventory/throwaways', 'notes',
'reports/today', 'reports/store', 'devices', 'license', 'apps', 'settings?tab=operation',
]
const SHOTS = ['dashboard', 'tables', 'tables?view=qr', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers', 'financials/expenses']
const SCREENS = [{ id: '1080p', width: 1920, height: 1080 }, { id: 'ultrawide', width: 3440, height: 1440 }]
const MODULES = ['connect_orders', 'connect_menu', 'crm', 'tabs', 'expenses', 'inventory', 'notes', 'chat', 'reservations', 'pricing', 'signage', 'staff_planning']
const backend = await startBackend({ port: 8067, siteId: 'test-site-1', env: { LICENSE_MODE: 'off' } })
const APP = 'http://localhost:5191'
const log = openSync(path.join(OUT, 'vite-5191.log'), 'w')
const vite = spawn('npx', ['vite', '--port', '5191', '--strictPort'], {
cwd: path.join(CS, 'manager_dashboard'), shell: process.platform === 'win32', detached: process.platform !== 'win32',
stdio: ['ignore', log, log], env: { ...process.env, XENIA_BACKEND: backend.url },
})
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
const r = reporter('manager layout (the page rule): fills 1080p, 16:9 and centred on ultrawides, scrolls')
const name = p => p.replace(/[/?=]/g, '-')
try {
await waitHttp(APP)
const boss = await login(backend.url)
const call = (method, url, body) => fetch(`${backend.url}${url}`, { method, headers: { 'content-type': 'application/json', authorization: `Bearer ${boss}` }, body: body ? JSON.stringify(body) : undefined })
for (const m of MODULES) await call('PUT', `/api/platform/modules/${m}`, { enabled: true }).catch(() => {})
await call('POST', '/api/business-day/open', {}).catch(() => {})
const errors = []
for (const screen of SCREENS) {
const ctx = await browser.newContext({ viewport: { width: screen.width, height: screen.height } })
const page = await ctx.newPage()
page.on('pageerror', e => errors.push(String(e)))
await page.goto(`${APP}/login`)
await page.getByTestId('login-form').waitFor({ timeout: 60_000 })
if (!(await page.getByTestId('login-account').count())) await page.getByLabel('Username').fill('manager')
await page.getByLabel('Password').fill('password')
await page.getByRole('button', { name: 'Sign in', exact: true }).click()
await page.waitForURL(u => u.pathname === '/dashboard', { timeout: 20_000 })
const bad = []
for (const p of PAGES) {
await page.goto(`${APP}/${p}`)
await page.waitForLoadState('networkidle').catch(() => {})
await sleep(500)
const m = await page.evaluate(() => {
const body = document.querySelector('main .x-page__body')
const main = document.querySelector('main')
if (!body || !main) return null
const b = body.getBoundingClientRect(); const a = main.getBoundingClientRect()
const scroll = body.closest('.x-page__scroll')
// a form page (settings) is centred at its own width
const form = body.classList.contains('x-page__body--form')
return { form, left: b.left - a.left, right: a.right - b.right, width: b.width, area: a.width, cap: Math.max(1280, innerHeight * 16 / 9),
scrolls: scroll.scrollHeight <= scroll.clientHeight + 1 || getComputedStyle(scroll).overflowY === 'auto' }
})
if (!m) { bad.push(`${p}: no <Page>`); continue }
const centred = Math.abs(m.left - m.right) <= 2
const fills = m.form || m.width >= Math.min(m.area, m.cap) - 2
if (!centred || !fills || !m.scrolls) bad.push(`${p}: ${JSON.stringify(m)}`)
if (SHOTS.includes(p)) await page.screenshot({ path: path.join(DIR, `${name(p)}-${screen.id}.png`) })
}
r.check(`${screen.id}: every page fills its area up to 16:9, centred, and scrolls`, bad.length === 0, bad.join('\n'))
if (screen.id === '1080p') {
// the shared dropdown: multi-select, same height as the search box
await page.goto(`${APP}/financials/expenses`)
const search = page.locator('.x-search input')
await search.waitFor()
const hs = await search.boundingBox()
const dd = page.getByTestId('expenses-status')
const hd = await dd.boundingBox()
r.check('expenses: dropdowns are as tall as the search box', Math.abs(hs.height - hd.height) < 1, `${hs.height} vs ${hd.height}`)
await dd.click()
await page.locator('.x-dropdown__menu').waitFor()
await page.screenshot({ path: path.join(DIR, 'expenses-dropdown-open.png') })
await page.keyboard.press('Escape')
// the day summary
await page.goto(`${APP}/dashboard`)
await page.getByTestId('day-stats').click()
await page.getByTestId('day-summary').waitFor()
await sleep(400)
const tabsScroll = await page.evaluate(() => { const l = document.querySelector('.x-dialog .x-tabs__list'); return l.scrollHeight - l.clientHeight })
r.check('day summary: the tab strip has no up/down scroll', tabsScroll === 0, String(tabsScroll))
await page.screenshot({ path: path.join(DIR, 'day-summary.png') })
await page.getByTestId('day-tab-staff').click()
await sleep(300)
await page.screenshot({ path: path.join(DIR, 'day-summary-staff.png') })
}
await ctx.close()
}
r.check('no page errors', errors.length === 0, errors.slice(0, 3).join(' | '))
console.log(` screenshots: ${DIR}`)
} finally {
await browser.close()
killTree(vite)
await backend.stop()
}
process.exit(r.done() ? 1 : 0)
+1 -1
View File
@@ -23,7 +23,7 @@ const LOOKS = [
...(extra ? [{ id: 'nord-light', mode: 'light', palette: 'nord', style: 'sharp' }, { id: 'nord-dark', mode: 'dark', palette: 'nord', style: 'sharp' }] : []),
]
const PAGES = [
'dashboard', 'tables', 'online-orders', 'online/fees', 'online/qr', 'crm/contacts', 'crm/customers', 'financials/expenses', 'financials/tabs',
'dashboard', 'tables', 'online-orders', 'online-orders?tab=settings', 'tables?view=qr', 'crm/contacts', 'crm/customers', 'financials/expenses', 'financials/tabs',
'management/products', 'management/media', 'management/signage', 'management/tables', 'management/staff', 'management/sessions',
'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'inventory/throwaways', 'inventory/stock', 'notes',
'reports/today', 'reports/store', 'reports/staff', 'reports/products', 'reports/prep-zones', 'reports/expenses', 'reports/technical', 'reports/misc',