feat(manager): every report on the shared controls (one toolbar height, modern dropdowns, shared tabs)

- The period: one toolbar (range / day as a Segmented, dates, quick choices, the report's own
  filters and export / print on the right), every control 44 px; the business day a searchable
  Dropdown.
- Report filters (person, category, status, waiter, table, printer) are the shared Dropdown;
  export / print buttons as tall as the rest; trends' step a Segmented.
- A report's tabs are the shared tab strip above the page; a day's and an order's sections too.
- e2e: the floor editor's edge '+' and the layout check cover products, tables set-up and the
  channel prices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 15:27:07 +02:00
co-authored by Claude Opus 5.5
parent 244e93f827
commit 9021373a6b
13 changed files with 71 additions and 93 deletions
@@ -7,7 +7,7 @@ import toast from 'react-hot-toast'
import { ArrowDown, ArrowUp, Download, Info } from 'lucide-react'
import { errorMessage } from '@xenia/api'
import { useFormat, useTranslation } from '@xenia/i18n'
import { Button, EmptyState, InfoTip, Page, Spinner, cx } from '@xenia/ui'
import { Button, EmptyState, InfoTip, Page, PageHeader, Spinner, Tabs, cx } from '@xenia/ui'
import client from '../../../api/client'
import { sortRows } from './reportLogic'
@@ -17,21 +17,11 @@ export function ReportPage({ title, tabs = [], children, testId }) {
const active = tabs.find(t => t.id === params.get('tab'))?.id ?? tabs[0]?.id
const tab = tabs.find(t => t.id === active)
return (
<Page testId={testId}>
<header className="flex flex-wrap items-end gap-3">
<h1 className="text-title font-semibold text-ink flex-1 min-w-0">{title}</h1>
{tabs.length > 1 && (
<nav className="flex flex-wrap gap-1" role="tablist">
{tabs.map(t => (
<Button key={t.id} size="sm" variant={t.id === active ? 'primary' : 'ghost'} role="tab" aria-selected={t.id === active}
onClick={() => setParams(p => { const n = new URLSearchParams(p); n.set('tab', t.id); return n }, { replace: true })} data-testid={`report-tab-${t.id}`}>
{t.label}
</Button>
))}
</nav>
)}
</header>
{tab ? <tab.Component key={tab.id} /> : children}
<Page testId={testId}
top={tabs.length > 1 ? <Tabs size="lg" value={active} tabs={tabs.map(t => ({ id: t.id, label: t.label, testId: `report-tab-${t.id}` }))}
onChange={id => setParams(p => { const n = new URLSearchParams(p); n.set('tab', id); return n }, { replace: true })} /> : undefined}>
<PageHeader title={title} />
{tab ? <tab.Component key={tab.id} /> : children}
</Page>
)
}
@@ -149,5 +139,5 @@ export function ExportButton({ endpoint, params, filename }) {
setTimeout(() => URL.revokeObjectURL(url), 1000)
} catch (err) { toast.error(errorMessage(err, t)) } finally { setBusy(false) }
}
return <Button size="sm" variant="secondary" icon={<Download size={14} />} loading={busy} onClick={run} data-testid="report-export">{t('reports.export')}</Button>
return <Button variant="secondary" icon={<Download size={16} />} loading={busy} onClick={run} data-testid="report-export">{t('reports.export')}</Button>
}