feat(manager): Settings full width with its cards in columns, tabs that wrap instead of hiding

Owner 2026-11-23 (plan 6F.0): Settings was the only 880 px page and its 11 tabs scrolled out of
sight ('Operatio...'). Now full width like every page; each tab's cards sit in the new @xenia/ui
<Columns> (cards flow down then across, 34rem columns: two on 1080p, three on an ultrawide, one on a
laptop), settings rows keep switches at the right edge. Tabs everywhere wrap onto another row when
they don't fit. manager_layout e2e: Settings tabs, a 1366x768 screen, every tab visible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 06:24:44 +02:00
co-authored by Claude Opus 5.5
parent cd8218689c
commit 33a5125abc
15 changed files with 73 additions and 37 deletions
+4 -2
View File
@@ -30,11 +30,12 @@ Every page's root is `<Page>` from `@xenia/ui`. It provides:
</Page>
```
- `top={<Tabs … />}` keeps a tab strip above the scrolling part (Online orders, Settings). The tab is kept in the address (`?tab=`).
- `top={<Tabs … />}` keeps a tab strip above the scrolling part (Online orders, Settings). The tab is kept in the address (`?tab=`). Tabs that don't fit **wrap onto another row**; they are never hidden in a sideways scroll (6F.0, owner 2026-11-23).
- `header={<PageHeader … />}` with `top`: the page's title and description come **first**, then the tabs (Offers & pricing). Each tab then starts with its own head: title, description, its "New" button at the top right.
- `fit`: the page is exactly the screen's height and doesn't scroll; its `Pane`s do, each on its own (Products). Put them in an element with `x-page__fill`. Phones scroll as usual.
- The scrollbar's room is always kept (`scrollbar-gutter: stable`), so a short tab is exactly as wide as a long one.
- `width="form"` for settings and forms (centred at `--x-page-form-max`, 880 px). Lists, tables and dashboards use the default (full).
- Every page is full width, **Settings included** (6F.0, owner 2026-11-23: an 880 px Settings page looked narrower than the rest and cut its tabs). Settings and other pages of cards put them in `<Columns>`: cards flow top to bottom, then into the next column, each column at least 34rem (two on 1080p, three on an ultrawide, one on a laptop or phone); `x-columns__wide` / `<ColumnsWide>` spans all columns (an intro row, a wide editor). `width="form"` (880 px, centred) stays only for a single form that reads better narrow; no page uses it now.
- A settings row (`SettingRow`) keeps its control in a 16rem box on the right: selects and inputs fill it, switches and buttons sit at its right edge.
- **Never** put `p-*`, `max-w-*`, `mx-auto`, `h-full` or `overflow-*` on a page's root, and never nest a second width limit inside it.
- Checked by `tests/e2e/manager_layout.mjs` (1920×1080 and 3440×1440: every page fills / is centred, and scrolls). Add a new page to its `PAGES` list.
@@ -45,6 +46,7 @@ Every page is on `<Page>` except Inventory → Stock (a placeholder). Two-column
| Need | Use | Notes |
|---|---|---|
| A page | `Page`, `PageHeader` | §2 |
| Cards in columns (settings) | `Columns`, `ColumnsWide` | §2; a card never splits across two columns |
| Filters / actions over a list | `Toolbar`, `ToolbarSpacer` | every control in it the same height; the search box grows |
| Search | `SearchInput` | icon, clear button; `onChange(text)` |
| Choose one / several | `Dropdown` (`multiple`) | **never a native `<select>` in a toolbar.** Multi: value is an array, `[]` = all (`allLabel`). Options can carry a `dot` (a zone's colour) and a `hint`. Search box from 9 options. Same heights as `Input`. Native `Select` stays only inside forms where the phone's own picker is better |
@@ -5,7 +5,7 @@
import { useSearchParams } from 'react-router-dom'
import { useCan, useModule } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { Page, Tabs } from '@xenia/ui'
import { Columns, Page, Tabs } from '@xenia/ui'
import PrintingSettings from '../printing/PrintingSettings'
import CustomerDisplaySettings from './sections/CustomerDisplaySettings'
import DevelopmentSettings from './sections/DevelopmentSettings'
@@ -20,10 +20,10 @@ import IdentitySettings from './sections/IdentitySettings'
const TABS = {
'app-info': () => <SystemSettings />,
venue: () => <VenueSettings />,
venue: () => <Columns><VenueSettings /></Columns>,
identity: () => <IdentitySettings />,
'customer-display': () => <CustomerDisplaySettings />,
'menu-tablets': () => <MenuTabletSettings />,
'menu-tablets': () => <Columns><MenuTabletSettings /></Columns>,
security: () => <SecuritySettings />,
operation: () => <OperationSettings />,
colours: () => <TableColours />,
@@ -49,8 +49,8 @@ export default function SettingsPage() {
const active = tabs.includes(params.get('tab')) ? params.get('tab') : tabs[0]
const Tab = TABS[active]
return (
// settings are forms: the page's form width, centred (the page rule, 2026-11-20)
<Page testId="settings-page" width="form" aria-label={t('settings.title')}
// full width like every page (6F.0, owner 2026-11-23); each tab's cards sit in <Columns>
<Page testId="settings-page" aria-label={t('settings.title')}
top={<Tabs size="lg" value={active} onChange={id => setParams({ tab: id }, { replace: true })}
tabs={tabs.map(id => ({ id, label: t(`settings.tabs.${id}`), testId: `settings-tab-${id}` }))} />}>
<Tab />
@@ -1,7 +1,7 @@
// Settings → Development (plan step 6.14a; was the v1 DevelopmentTab): for testing only. Printing
// "spoof": every print job is dropped silently and the apps behave as if it printed.
import { useTranslation } from '@xenia/i18n'
import { Spinner, Switch } from '@xenia/ui'
import { Columns, Spinner, Switch } from '@xenia/ui'
import { SettingRow, SettingsCard } from './SettingsCard'
import { useSettings } from './useSettings'
@@ -11,13 +11,13 @@ export default function DevelopmentSettings() {
if (s.loading) return <div className="py-8 flex justify-center"><Spinner /></div>
const spoof = s.get('dev.spoof_printing', 'false') === 'true'
return (
<div className="grid gap-5" data-testid="settings-development">
<p className="rounded-card bg-danger-soft text-danger-ink p-3 text-label" role="note">{t('settings.dev.warning')}</p>
<Columns testId="settings-development">
<p className="x-columns__wide rounded-card bg-danger-soft text-danger-ink p-3 text-label" role="note">{t('settings.dev.warning')}</p>
<SettingsCard title={t('settings.dev.title')}>
<SettingRow label={t('settings.dev.spoof')} hint={t('settings.dev.spoofHint')} warning={spoof ? t('settings.dev.spoofOn') : undefined}>
<Switch checked={spoof} disabled={s.saving} onChange={v => s.save('dev.spoof_printing', v)} aria-label={t('settings.dev.spoof')} data-testid="setting-dev.spoof_printing" />
</SettingRow>
</SettingsCard>
</div>
</Columns>
)
}
@@ -9,7 +9,7 @@ import toast from 'react-hot-toast'
import { CheckCircle2, Plus, Trash2, XCircle } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useTranslation } from '@xenia/i18n'
import { Button, Field, IconButton, Input, Select, Spinner, Switch } from '@xenia/ui'
import { Button, Columns, Field, IconButton, Input, Select, Spinner, Switch } from '@xenia/ui'
import client from '../../../api/client'
import { SettingRow, SettingsCard } from './SettingsCard'
import { cleanVatGroups, endLines, readJson } from './settingsLogic'
@@ -21,7 +21,7 @@ export default function FiscalSettings() {
if (s.loading) return <div className="py-8 flex justify-center"><Spinner /></div>
const on = s.get('fiscal.enabled', 'false') === 'true'
return (
<div className="grid gap-5" data-testid="settings-fiscal">
<Columns testId="settings-fiscal">
<SettingsCard title={t('settings.fiscal.title')} description={t('settings.fiscal.intro')}>
<SettingRow label={t('settings.fiscal.enabled')} hint={t('settings.fiscal.enabledHint')}
warning={on ? t('settings.fiscal.onWarning') : undefined}>
@@ -37,7 +37,7 @@ export default function FiscalSettings() {
<Folders s={s} />
<EndMessage s={s} />
<VatGroups s={s} />
</div>
</Columns>
)
}
@@ -10,7 +10,7 @@ import { Plus, Trash2 } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useCan } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { Button, ColourField, Dropdown, Field, IconButton, Input, Spinner, Switch } from '@xenia/ui'
import { Button, ColourField, Columns, Dropdown, Field, IconButton, Input, Spinner, Switch } from '@xenia/ui'
import { wifiQr } from '@xenia/signage/logic'
import client from '../../../api/client'
import MediaField from '../../media/MediaField'
@@ -50,8 +50,8 @@ function IdentityForm({ saved }) {
const qr = wifiQr(wifi)
return (
<div className="grid gap-5" data-testid="settings-identity">
<div className="flex flex-wrap items-center gap-3">
<Columns testId="settings-identity">
<div className="x-columns__wide flex flex-wrap items-center gap-3">
<p className="text-label text-ink-2 flex-1 min-w-[16rem]">{t('identity.intro')}</p>
{dirty && <span className="text-label text-ink-3">{t('identity.unsaved')}</span>}
<Button variant="secondary" disabled={!dirty || busy} onClick={() => setD(structuredClone(saved))}>{t('identity.undo')}</Button>
@@ -141,6 +141,6 @@ function IdentityForm({ saved }) {
))}
</div>
</SettingsCard>
</div>
</Columns>
)
}
@@ -11,7 +11,7 @@ import { ArrowDown, ArrowUp, Plus, RefreshCw, Trash2 } from 'lucide-react'
import { useModule } from '@xenia/access'
import { errorMessage } from '@xenia/api'
import { useTranslation } from '@xenia/i18n'
import { Button, IconButton, Input, Spinner, Switch } from '@xenia/ui'
import { Button, Columns, IconButton, Input, Spinner, Switch } from '@xenia/ui'
import client from '../../../api/client'
import QuickMessages from './QuickMessages'
import RolePermissions from './RolePermissions'
@@ -26,13 +26,13 @@ export default function OperationSettings() {
const chat = useModule('chat')
const qrMenu = useModule('connect_menu')
return (
<div className="grid gap-5" data-testid="settings-operation">
<Columns testId="settings-operation">
<RolePermissions />
{ordering && <OrderingSettings />}
{ordering && <TableFlags />}
{chat && <QuickMessages />}
{qrMenu && <MenuSync />}
</div>
</Columns>
)
}
@@ -8,7 +8,7 @@ import toast from 'react-hot-toast'
import { Copy, RefreshCw } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useTranslation } from '@xenia/i18n'
import { Button, IconButton, Select, Spinner, Switch } from '@xenia/ui'
import { Button, Columns, IconButton, Select, Spinner, Switch } from '@xenia/ui'
import client from '../../../api/client'
import { useLiveQuery } from '../../../live/useLiveQuery'
import { Pill } from '../../overview/parts'
@@ -19,11 +19,11 @@ import { useSettings } from './useSettings'
export default function SecuritySettings() {
return (
<div className="grid gap-5" data-testid="settings-security">
<Columns testId="settings-security">
<SignInSettings />
<IdleSettings />
<RecoveryCodes />
</div>
</Columns>
)
}
@@ -25,7 +25,7 @@ export function SettingRow({ label, hint, tip, children, warning, htmlFor }) {
</div>
{hint && <p className="text-label text-ink-2 mt-0.5">{hint}</p>}
</div>
<div className="sm:w-64 shrink-0">{children}</div>
<div className="sm:w-64 shrink-0 flex sm:justify-end [&>*]:max-w-full [&>.x-select]:w-full [&>.x-dropdown]:w-full [&>.x-input]:w-full">{children}</div>
</div>
{warning && <p className="mt-2 rounded-control bg-warning-soft text-warning-ink text-label px-3 py-2" role="note">{warning}</p>}
</div>
@@ -10,7 +10,7 @@ import { Lock, LockOpen, QrCode as QrIcon, RefreshCw } from 'lucide-react'
import { useAccess } from '@xenia/access'
import { errorMessage } from '@xenia/api'
import { useFormat, useTranslation } from '@xenia/i18n'
import { Button, Dialog, Input, Spinner } from '@xenia/ui'
import { Button, Columns, Dialog, Input, Spinner } from '@xenia/ui'
import { QrCode } from '@xenia/ui/qr'
import client from '../../../api/client'
import { useLiveQuery } from '../../../live/useLiveQuery'
@@ -43,7 +43,7 @@ export default function SystemSettings() {
const counts = ['categories', 'products', 'tables', 'table_groups', 'managers', 'waiters']
return (
<div className="grid gap-5" data-testid="settings-system">
<Columns testId="settings-system">
<SettingsCard title={t('settings.system.title')}>
<SettingRow label={t('settings.system.version')}>
<span className="flex flex-wrap items-center gap-2 text-body font-semibold text-ink" data-testid="system-version">
@@ -106,7 +106,7 @@ export default function SystemSettings() {
</div>
</Dialog>
)}
</div>
</Columns>
)
}
@@ -1,15 +1,16 @@
// Settings → Printing (plan step 6.10; replaces the v1 "Print fonts" tab): when managers are
// told about tickets that keep failing, the printers, and the tickets' look and beep.
import { Columns } from '@xenia/ui'
import PrintAlertSetting from '../Settings/sections/PrintAlertSetting'
import PrintersCard from './PrintersCard'
import TicketSettings from './TicketSettings'
export default function PrintingSettings() {
return (
<div className="grid gap-5" data-testid="printing-settings">
<Columns testId="printing-settings">
<PrintersCard />
<PrintAlertSetting />
<TicketSettings />
</div>
</Columns>
)
}
+7 -2
View File
@@ -409,6 +409,11 @@
.x-page--fit .x-page__body > * { flex-shrink: 0; }
.x-page--fit .x-page__body > .x-page__fill { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
}
/* cards in columns (6F.0): settings and forms on a full-width page */
.x-columns { columns: var(--x-columns-min, 34rem); column-gap: var(--x-page-gap); }
.x-columns > * { break-inside: avoid; margin-bottom: var(--x-page-gap); }
.x-columns > *:last-child { margin-bottom: 0; }
.x-columns > .x-columns__wide { column-span: all; }
.x-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--x-space-3); }
.x-page-header__titles { flex: 1; min-width: 0; }
.x-page-header__title { margin: 0; display: flex; align-items: center; gap: var(--x-space-1); font-size: var(--x-text-title); line-height: var(--x-leading-title); font-weight: var(--x-weight-semibold); color: var(--x-ink); }
@@ -641,8 +646,8 @@
/* ── Tabs ────────────────────────────────────────────────────────────────── */
.x-tabs { display: flex; align-items: center; gap: var(--x-space-2); box-shadow: inset 0 calc(-1 * var(--x-border-width)) 0 var(--x-line); }
.x-page__top .x-tabs { box-shadow: none; }
.x-tabs__list { flex: 1; min-width: 0; display: flex; gap: var(--x-space-1); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.x-tabs__list::-webkit-scrollbar { display: none; }
/* tabs that don't fit wrap onto another row: never hidden in a sideways scroll (6F.0, 2026-11-23) */
.x-tabs__list { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: var(--x-space-1); }
.x-tabs__tab {
display: inline-flex; align-items: center; gap: var(--x-space-1-5); flex-shrink: 0;
padding: var(--x-space-2-5) var(--x-space-3); border: 0; background: transparent;
+1 -1
View File
@@ -67,7 +67,7 @@ export function Segmented({ options = [], value, onChange, size = 'md', fill = f
}
/**
* Tabs with an underline: a page's or a dialog's sections. Scrolls sideways when they don't fit,
* Tabs with an underline: a page's or a dialog's sections. Tabs that don't fit wrap onto another row (6F.0),
* never up and down. tabs: [{ id, label, badge?, warn?, testId? }].
* <Tabs tabs={tabs} value={tab} onChange={setTab} />
* end: an element at the right end of the strip (a refresh button…).
+18
View File
@@ -75,3 +75,21 @@ export function Pane({ header, footer, sunken = false, as: Tag = 'section', clas
</Tag>
)
}
/**
* Cards in columns (2026-11-23, plan 6F.0): a full-width page of settings or forms keeps each card
* at a readable width. Cards flow top to bottom, then into the next column; a column is at least
* `min` wide (default 34rem), so a 1080p screen shows two, an ultrawide three, a phone one.
* A child with `x-columns__wide` (or wrapped in <ColumnsWide>) spans every column (a header row,
* a wide table).
* <Columns testId="settings-operation"><SettingsCard …/><SettingsCard …/></Columns>
*/
export function Columns({ min, className, testId, style, children, ...rest }) {
return (
<div className={cx('x-columns', className)} data-testid={testId}
style={min ? { ...style, '--x-columns-min': min } : style} {...rest}>{children}</div>
)
}
export function ColumnsWide({ className, children, ...rest }) {
return <div className={cx('x-columns__wide', className)} {...rest}>{children}</div>
}
+1 -1
View File
@@ -31,7 +31,7 @@ export { Slider } from './components/Slider.jsx'
export { NumberInput } from './components/NumberInput.jsx'
export { Notice } from './components/Notice.jsx'
export { IconPicker } from './components/IconPicker.jsx'
export { Page, PageHeader, Pane, Toolbar, ToolbarSpacer } from './components/Page.jsx'
export { Columns, ColumnsWide, Page, PageHeader, Pane, Toolbar, ToolbarSpacer } from './components/Page.jsx'
export { SearchInput, FilterChip, Segmented, Tabs } from './components/Controls.jsx'
export { Switch } from './components/Switch.jsx'
export { Stepper } from './components/Stepper.jsx'
+13 -3
View File
@@ -23,10 +23,11 @@ const PAGES = [
'management/approvals', 'management/schedule', 'management/prep-zones', 'management/pricing', 'management/pricing?tab=channels',
'management/products', 'management/tables', 'management/tables?tab=floor', 'management/scenes', 'management/signage?tab=playlists', 'management/signage?tab=schedules', 'inventory/throwaways', 'notes',
'reports/today', 'reports/store', 'devices', 'license', 'apps', 'settings?tab=operation',
'settings?tab=security', 'settings?tab=identity', 'settings?tab=print-fonts', 'settings?tab=venue',
]
const SHOTS = ['dashboard', 'tables', 'tables?view=qr', 'online-orders?tab=settings', 'crm/contacts', 'crm/customers', 'financials/expenses',
'management/products', 'management/tables?tab=floor', 'management/pricing?tab=channels', 'financials/tabs', 'management/staff']
const SCREENS = [{ id: '1080p', width: 1920, height: 1080 }, { id: 'ultrawide', width: 3440, height: 1440 }]
'management/products', 'management/tables?tab=floor', 'management/pricing?tab=channels', 'financials/tabs', 'management/staff', 'settings?tab=operation']
const SCREENS = [{ id: '1080p', width: 1920, height: 1080 }, { id: 'ultrawide', width: 3440, height: 1440 }, { id: 'laptop', width: 1366, height: 768 }]
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' } })
@@ -69,7 +70,7 @@ try {
// the area: the scroller without its scrollbar's room (kept on every page, 2026-11-21)
const b = body.getBoundingClientRect(); const s = scroll.getBoundingClientRect()
const a = { left: s.left, right: s.left + scroll.clientWidth, width: scroll.clientWidth }
// a form page (settings) is centred at its own width
// a form page (width="form": none left since 6F.0) 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: 2200,
scrolls: scroll.scrollHeight <= scroll.clientHeight + 1 || getComputedStyle(scroll).overflowY === 'auto' }
@@ -82,6 +83,15 @@ try {
}
r.check(`${screen.id}: every page fills its area up to 2200 px, centred, and scrolls`, bad.length === 0, bad.join('\n'))
// Settings (6F.0, owner 2026-11-23): full width like every page, and every tab's button inside
// the window (tabs that don't fit wrap onto another row, never hidden in a sideways scroll)
await page.goto(`${APP}/settings`)
await page.getByTestId('settings-page').waitFor()
const tabsIn = await page.evaluate(() => [...document.querySelectorAll('[data-testid^="settings-tab-"]')]
.map(e => { const b = e.getBoundingClientRect(); return { id: e.dataset.testid, in: b.left >= 0 && b.right <= innerWidth && b.width > 0 } }))
r.check(`${screen.id}: settings: every tab is visible (${tabsIn.length})`, tabsIn.length >= 8 && tabsIn.every(x => x.in),
JSON.stringify(tabsIn.filter(x => !x.in)))
// Products (2026-11-21): the page doesn't scroll, its two panes do, each on its own
await page.goto(`${APP}/management/products`)
await page.getByTestId('products-panel').waitFor()