Files
xenia-pos-local/manager_dashboard/src/pages/Settings/SettingsPage.jsx
T
bonaminandClaude Opus 5.5 33a5125abc 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>
2026-11-23 06:24:44 +02:00

60 lines
2.9 KiB
React

// Settings (plan step 6.14a; every tab on v2): General, Venue & language, the customer display and
// menu tablets (with those apps), Sign-in & security, Operation, Appearance (the waiter app's table
// colours), Printing, Fiscal device (with that app) and Development. The tab is in the address
// (?tab=…), so a link or a reload opens the same one. Everything here needs core.settings.manage.
import { useSearchParams } from 'react-router-dom'
import { useCan, useModule } from '@xenia/access'
import { useTranslation } from '@xenia/i18n'
import { Columns, Page, Tabs } from '@xenia/ui'
import PrintingSettings from '../printing/PrintingSettings'
import CustomerDisplaySettings from './sections/CustomerDisplaySettings'
import DevelopmentSettings from './sections/DevelopmentSettings'
import FiscalSettings from './sections/FiscalSettings'
import MenuTabletSettings from './sections/MenuTabletSettings'
import OperationSettings from './sections/OperationSettings'
import SecuritySettings from './sections/SecuritySettings'
import SystemSettings from './sections/SystemSettings'
import TableColours from './sections/TableColours'
import VenueSettings from './sections/VenueSettings'
import IdentitySettings from './sections/IdentitySettings'
const TABS = {
'app-info': () => <SystemSettings />,
venue: () => <Columns><VenueSettings /></Columns>,
identity: () => <IdentitySettings />,
'customer-display': () => <CustomerDisplaySettings />,
'menu-tablets': () => <Columns><MenuTabletSettings /></Columns>,
security: () => <SecuritySettings />,
operation: () => <OperationSettings />,
colours: () => <TableColours />,
'print-fonts': () => <PrintingSettings />,
fiscal: () => <FiscalSettings />,
development: () => <DevelopmentSettings />,
}
export default function SettingsPage() {
const { t } = useTranslation('manager')
const [params, setParams] = useSearchParams()
// tabs that need an app (and, for the screens, the key to set them up)
const displayOn = useModule('customer_display')
const displayKey = useCan('customer_display.manage')
const tabletOn = useModule('menu_tablet')
const tabletKey = useCan('menu_tablet.manage')
const display = displayOn && displayKey
const tablets = tabletOn && tabletKey
const waiterApp = useModule('waiter_app')
const fiscal = useModule('fiscal')
const shown = { 'customer-display': display, 'menu-tablets': tablets, colours: waiterApp, fiscal }
const tabs = Object.keys(TABS).filter(id => shown[id] ?? true)
const active = tabs.includes(params.get('tab')) ? params.get('tab') : tabs[0]
const Tab = TABS[active]
return (
// 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 />
</Page>
)
}