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:
@@ -70,7 +70,7 @@ function BookingRow({ booking: b, onEdit, onStatus, onConfirm, onDecline }) {
|
||||
const { formatTime, formatDateTime } = useFormat()
|
||||
const table = b.table_label || (b.table_id ? `#${b.table_id}` : null)
|
||||
return (
|
||||
<li className="flex items-center gap-3 px-4 py-2.5" data-testid="booking-row" data-status={b.status}>
|
||||
<li className="flex items-center gap-3 px-card py-3" data-testid="booking-row" data-status={b.status}>
|
||||
<span className="w-12 shrink-0 text-center grid">
|
||||
<span className="text-body font-bold tabular-nums text-ink">{formatTime(b.reserved_for)}</span>
|
||||
<span className="text-caption text-ink-3">{formatDateTime(b.reserved_for, { day: 'numeric', month: 'short' })}</span>
|
||||
|
||||
@@ -6,11 +6,10 @@ import { useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { errorMessage } from '@xenia/api'
|
||||
import { parseNumber, useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { Button, Dialog, EmptyState, Spinner, cx } from '@xenia/ui'
|
||||
import { Button, Dialog, EmptyState, Spinner, Tabs } from '@xenia/ui'
|
||||
import client from '../../api/client'
|
||||
import { useLiveQuery } from '../../live/useLiveQuery'
|
||||
import { CashTab, ChecksTab, MoneyTab, PrintersTab, StaffTab, ZonesTab } from './DaySummaryTabs'
|
||||
import { Pill } from './parts'
|
||||
|
||||
export default function DaySummaryDialog({ dayId, closing = false, onClose, onClosed }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -40,13 +39,13 @@ export default function DaySummaryDialog({ dayId, closing = false, onClose, onCl
|
||||
}
|
||||
|
||||
const tabs = [
|
||||
{ id: 'money', label: t('overview.day.tab.money') },
|
||||
{ id: 'staff', label: t('overview.day.tab.staff'), badge: data?.waiters?.length },
|
||||
{ id: 'zones', label: t('overview.day.tab.zones'), badge: data?.zones?.length },
|
||||
{ id: 'printers', label: t('overview.day.tab.printers'), badge: data?.printers?.length },
|
||||
{ id: 'money', label: t('overview.day.tab.money'), testId: 'day-tab-money' },
|
||||
{ id: 'staff', label: t('overview.day.tab.staff'), badge: data?.waiters?.length, testId: 'day-tab-staff' },
|
||||
{ id: 'zones', label: t('overview.day.tab.zones'), badge: data?.zones?.length, testId: 'day-tab-zones' },
|
||||
{ id: 'printers', label: t('overview.day.tab.printers'), badge: data?.printers?.length, testId: 'day-tab-printers' },
|
||||
...(closing ? [
|
||||
{ id: 'cash', label: t('overview.day.tab.cash') },
|
||||
{ id: 'checks', label: t('overview.day.tab.checks'), badge: data?.checks ? data.checks.open_orders + data.checks.active_shifts : null, warn: data?.checks?.with_unpaid_items > 0 },
|
||||
{ id: 'cash', label: t('overview.day.tab.cash'), testId: 'day-tab-cash' },
|
||||
{ id: 'checks', label: t('overview.day.tab.checks'), badge: data?.checks ? data.checks.open_orders + data.checks.active_shifts : null, warn: data?.checks?.with_unpaid_items > 0, testId: 'day-tab-checks' },
|
||||
] : []),
|
||||
]
|
||||
|
||||
@@ -58,23 +57,17 @@ export default function DaySummaryDialog({ dayId, closing = false, onClose, onCl
|
||||
</>)
|
||||
|
||||
return (
|
||||
<Dialog open size="lg" onClose={onClose} footer={footer || undefined}
|
||||
<Dialog open size="xl" onClose={onClose} footer={footer || undefined}
|
||||
title={closing ? t('overview.day.closeTitle') : t('overview.day.statsTitle')}
|
||||
description={data && <span className="inline-flex items-center gap-2">
|
||||
<Pill tone={data.status === 'open' ? 'success' : 'neutral'}>{data.status === 'open' ? t('overview.day.open') : t('overview.day.closedState')}</Pill>
|
||||
{t('overview.day.openedAt', { time: formatDateTime(data.opened_at, 'datetimeShort') })}
|
||||
description={data && <span className="inline-flex flex-wrap items-center gap-x-1.5 text-label" data-testid="day-status">
|
||||
{data.status === 'open'
|
||||
? <span className="inline-flex items-center gap-1.5 font-semibold text-success-ink"><span className="w-2 h-2 rounded-full bg-success" aria-hidden="true" />{t('overview.day.open')}</span>
|
||||
: <span>{t('overview.day.closedState')}</span>}
|
||||
<span aria-hidden="true">·</span>
|
||||
<span>{t('overview.day.openedAt', { time: formatDateTime(data.opened_at, 'datetimeShort') })}</span>
|
||||
</span>}>
|
||||
<div className="grid gap-4" data-testid="day-summary">
|
||||
<div className="flex gap-1 overflow-x-auto border-b border-line -mx-1 px-1" role="tablist">
|
||||
{tabs.map(tb => (
|
||||
<button key={tb.id} type="button" role="tab" aria-selected={tab === tb.id} onClick={() => setTab(tb.id)} data-testid={`day-tab-${tb.id}`}
|
||||
className={cx('flex items-center gap-1.5 px-3 py-2 -mb-px border-b-2 text-label whitespace-nowrap transition-colors duration-fast',
|
||||
tab === tb.id ? 'border-accent text-ink font-semibold' : 'border-transparent text-ink-2 hover:text-ink')}>
|
||||
{tb.label}
|
||||
{tb.badge != null && <span className={cx('min-w-5 px-1 rounded-full text-caption font-bold tabular-nums', tb.warn ? 'bg-danger-soft text-danger-ink' : 'bg-surface-2 text-ink-2')}>{tb.badge}</span>}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Tabs tabs={tabs} value={tab} onChange={setTab} />
|
||||
{isPending && <div className="py-10 flex justify-center"><Spinner /></div>}
|
||||
{error && <EmptyState compact title={errorMessage(error, t)} />}
|
||||
{data && (<>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PAY_METHODS, cashCheck, paymentTotals } from './overviewLogic'
|
||||
import { Avatar, Figure, Money, Pill, SplitBar } from './parts'
|
||||
import { SOFT } from './tones'
|
||||
|
||||
const PAY_TONE = { cash: 'success', card: 'info', transfer: 'accent', treat: 'warning', other: 'neutral' }
|
||||
const PAY_TONE = { cash: 'success', card: 'info', transfer: 'accent', treat: 'warning', other: 'neutral', onTab: 'special' }
|
||||
|
||||
function usePayParts() {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -18,7 +18,7 @@ function usePayParts() {
|
||||
|
||||
function Row({ label, value, tone, warn, indent, sub, info }) {
|
||||
return (
|
||||
<div className={cx('flex items-baseline justify-between gap-3 py-1', indent && 'pl-4 text-label')}>
|
||||
<div className={cx('flex items-baseline justify-between gap-3 py-1 text-label', indent && 'pl-4')}>
|
||||
<span className={cx('flex-1 flex items-center gap-1', warn ? 'text-warning-ink' : indent ? 'text-ink-2' : 'text-ink')}>{label}{info}</span>
|
||||
<span className="text-right grid">
|
||||
<span className={cx('font-semibold tabular-nums', tone ?? 'text-ink')}>{value}</span>
|
||||
@@ -30,13 +30,23 @@ function Row({ label, value, tone, warn, indent, sub, info }) {
|
||||
|
||||
function Section({ title, children, shaded }) {
|
||||
return (
|
||||
<div className={cx('px-4 py-3 border-b border-line last:border-b-0', shaded && 'bg-surface-2')}>
|
||||
<div className="text-caption font-semibold uppercase tracking-wide text-ink-3 mb-1">{title}</div>
|
||||
<div className={cx('px-card py-card-y border-b border-line last:border-b-0', shaded && 'bg-surface-2')}>
|
||||
<div className="text-overline font-semibold uppercase tracking-wide text-ink-3 mb-1.5">{title}</div>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** One of the day's figures in its own box (v1's stat boxes). */
|
||||
function StatBox({ label, children }) {
|
||||
return (
|
||||
<div className="rounded-card border border-line bg-surface-2 px-4 py-3 grid gap-1 content-start min-w-0">
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-3 truncate">{label}</span>
|
||||
<span className="text-title font-bold tabular-nums text-ink truncate">{children}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function MoneyTab({ data }) {
|
||||
const { t } = useTranslation('manager')
|
||||
const { formatMoney, formatDateTime } = useFormat()
|
||||
@@ -45,15 +55,14 @@ export function MoneyTab({ data }) {
|
||||
const sign = v => (v >= 0 ? 'text-success-ink' : 'text-danger-ink')
|
||||
return (
|
||||
<div className="grid gap-4" data-testid="day-money">
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
|
||||
<Figure label={t('overview.day.revenue')}><Money value={data.total_revenue} /></Figure>
|
||||
<Figure label={t('overview.day.orders')}>{data.total_orders}</Figure>
|
||||
<Figure label={t('overview.day.items')}>{data.total_items_ordered}</Figure>
|
||||
<Figure label={t('overview.day.waiters')}>{staff.length}</Figure>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-6">
|
||||
<Figure label={t('overview.day.opened')}>{formatDateTime(data.opened_at, 'datetimeShort')}</Figure>
|
||||
<Figure label={t('overview.day.closed')}>{data.closed_at ? formatDateTime(data.closed_at, 'datetimeShort') : <span className="text-success-ink">{t('overview.day.stillOpen')}</span>}</Figure>
|
||||
{/* the six figures of the day, each in its own box, all the same size (as in v1) */}
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3" data-testid="day-figures">
|
||||
<StatBox label={t('overview.day.revenue')}><Money value={data.total_revenue} /></StatBox>
|
||||
<StatBox label={t('overview.day.orders')}>{data.total_orders}</StatBox>
|
||||
<StatBox label={t('overview.day.items')}>{data.total_items_ordered}</StatBox>
|
||||
<StatBox label={t('overview.day.waiters')}>{staff.length}</StatBox>
|
||||
<StatBox label={t('overview.day.opened')}>{formatDateTime(data.opened_at, 'datetimeShort')}</StatBox>
|
||||
<StatBox label={t('overview.day.closed')}>{data.closed_at ? formatDateTime(data.closed_at, 'datetimeShort') : <span className="text-success-ink">{t('overview.day.stillOpen')}</span>}</StatBox>
|
||||
</div>
|
||||
|
||||
<div className="rounded-card border border-line overflow-hidden">
|
||||
@@ -108,13 +117,16 @@ export function MoneyTab({ data }) {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-2">
|
||||
<span className="text-caption font-semibold uppercase tracking-wide text-ink-3">{t('overview.day.payments')}</span>
|
||||
{data.total_revenue > 0 ? <SplitBar parts={pay(paymentTotals(data.waiters))} /> : <span className="text-label text-ink-3">—</span>}
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-3">{t('overview.day.payments')}</span>
|
||||
{/* lines put on tabs are sold but not paid: their own part of the bar */}
|
||||
{data.total_revenue + (data.tabbed_revenue || 0) > 0
|
||||
? <SplitBar parts={[...pay(paymentTotals(data.waiters)), { key: 'onTab', tone: PAY_TONE.onTab, label: t('overview.pay.onTab'), value: data.tabbed_revenue || 0 }]} />
|
||||
: <span className="text-label text-ink-3">—</span>}
|
||||
</div>
|
||||
|
||||
{data.store_closing_cash != null && (
|
||||
<div className="rounded-card border border-line px-4 py-3">
|
||||
<div className="text-caption font-semibold uppercase tracking-wide text-ink-3 mb-1">{t('overview.day.drawer')}</div>
|
||||
<div className="rounded-card border border-line px-card py-card-y">
|
||||
<div className="text-overline font-semibold uppercase tracking-wide text-ink-3 mb-1.5">{t('overview.day.drawer')}</div>
|
||||
<Row label={t('overview.day.drawerExpected')} value={formatMoney(data.store_expected_closing)} />
|
||||
<Row label={t('overview.day.drawerCounted')} value={formatMoney(data.store_closing_cash)} />
|
||||
<Row label={t('overview.day.drawerDiff')} warn={data.store_cash_discrepancy !== 0}
|
||||
@@ -140,7 +152,7 @@ export function StaffTab({ data }) {
|
||||
return (
|
||||
<div key={w.waiter_id} className="rounded-card border border-line overflow-hidden">
|
||||
<button type="button" onClick={() => setOpen(shown ? null : w.waiter_id)} aria-expanded={shown}
|
||||
className="w-full flex flex-wrap items-center gap-3 px-4 py-3 text-left bg-surface hover:bg-surface-2">
|
||||
className="w-full flex flex-wrap items-center gap-x-6 gap-y-3 px-card py-card-y text-left bg-surface hover:bg-surface-2">
|
||||
<Avatar name={w.waiter_name} />
|
||||
<span className="flex-1 min-w-32 grid">
|
||||
<span className="text-body font-semibold text-ink">{w.waiter_name}</span>
|
||||
@@ -155,7 +167,7 @@ export function StaffTab({ data }) {
|
||||
<ChevronDown size={16} className={cx('text-ink-3 transition-transform duration-base', shown && 'rotate-180')} aria-hidden="true" />
|
||||
</button>
|
||||
{shown && (
|
||||
<div className="border-t border-line bg-surface-2 p-4 grid gap-3">
|
||||
<div className="border-t border-line bg-surface-2 p-card grid gap-4">
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
|
||||
<Figure label={t('overview.day.shiftStart')}>{w.shift_started_at ? formatTime(w.shift_started_at) : '—'}</Figure>
|
||||
<Figure label={t('overview.day.shiftEnd')}>{w.shift_ended_at ? formatTime(w.shift_ended_at) : <span className="text-success-ink">{t('overview.day.shiftRunning')}</span>}</Figure>
|
||||
@@ -181,7 +193,7 @@ export function ZonesTab({ data }) {
|
||||
return (
|
||||
<div className="grid gap-2" data-testid="day-zones">
|
||||
{data.zones.map(z => (
|
||||
<div key={z.group_id} className="rounded-card border border-line p-4 grid gap-3">
|
||||
<div key={z.group_id} className="rounded-card border border-line p-card grid gap-3">
|
||||
<div className="flex items-center gap-2">
|
||||
{/* a zone's colour is the venue's choice (data), not styling */}
|
||||
<span className={cx('w-3 h-3 rounded-sm shrink-0', !z.color && 'bg-ink-3')} style={z.color ? { background: z.color } : undefined} aria-hidden="true" />
|
||||
@@ -210,7 +222,7 @@ export function PrintersTab({ data }) {
|
||||
{data.printers.map(p => {
|
||||
const rate = p.jobs > 0 ? Math.round((p.success / p.jobs) * 100) : 0
|
||||
return (
|
||||
<div key={p.printer_id} className="rounded-card border border-line p-4 grid gap-3">
|
||||
<div key={p.printer_id} className="rounded-card border border-line p-card grid gap-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="w-9 h-9 grid place-items-center rounded-control bg-surface-2 text-ink-2"><Printer size={18} aria-hidden="true" /></span>
|
||||
<span className="flex-1 grid">
|
||||
@@ -247,8 +259,8 @@ export function CashTab({ data, counted, onCounted, value }) {
|
||||
const tone = check ? (check.state === 'even' ? 'success' : 'danger') : null
|
||||
return (
|
||||
<div className="grid gap-4" data-testid="day-cash">
|
||||
<div className="rounded-card border border-line bg-surface-2 px-4 py-3">
|
||||
<div className="text-caption font-semibold uppercase tracking-wide text-ink-3 mb-1">{t('overview.day.takings')}</div>
|
||||
<div className="rounded-card border border-line bg-surface-2 px-card py-card-y">
|
||||
<div className="text-overline font-semibold uppercase tracking-wide text-ink-3 mb-1.5">{t('overview.day.takings')}</div>
|
||||
<Row label={t('overview.day.staffTook')} value={formatMoney(data.total_waiter_collected)} />
|
||||
{data.tabs?.received_outside_shifts?.total > 0 && <Row indent label={t('overview.day.tabOutsideShifts')} value={formatMoney(data.tabs.received_outside_shifts.total)}
|
||||
info={<InfoTip>{t('overview.day.tabOutsideShiftsTip')}</InfoTip>} />}
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function MessagesCard({ staff, tables }) {
|
||||
const to = messageTargets(m, staff)
|
||||
const acks = messageAcks(m, staff.length)
|
||||
return (
|
||||
<li key={m.id} className="flex items-start gap-3 px-4 py-2.5" data-testid="message-row">
|
||||
<li key={m.id} className="flex items-start gap-3 px-card py-3" data-testid="message-row">
|
||||
<span className="flex-1 min-w-0 grid">
|
||||
<span className="text-body font-semibold text-ink">{m.body}</span>
|
||||
<span className="text-caption text-ink-3">{t('overview.messages.to', { who: to ? to.join(', ') : t('overview.messages.everyone'), time: formatTime(m.created_at) })}</span>
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function NotesCard() {
|
||||
return (
|
||||
<div className="relative" onMouseEnter={enter} onMouseLeave={leave}>
|
||||
<button type="button" onClick={() => navigate('/notes')} onFocus={() => setPreview(true)} onBlur={leave}
|
||||
className="w-full flex items-center gap-3 p-4 rounded-card border border-line bg-surface shadow-raised text-left hover:shadow-popover transition-shadow duration-fast"
|
||||
className="w-full flex items-center gap-3 px-card py-4 rounded-card border border-line bg-surface shadow-raised text-left hover:shadow-popover transition-shadow duration-fast"
|
||||
data-testid="notes-card">
|
||||
<span className="flex-1 min-w-0 grid">
|
||||
<span className="text-body-lg font-semibold text-ink">{t('overview.notes.title')}</span>
|
||||
@@ -41,7 +41,7 @@ export default function NotesCard() {
|
||||
{items.map(item => {
|
||||
const Icon = item.kind === 'todo' ? (item.is_done ? CheckSquare : Square) : item.is_pinned ? Pin : FileText
|
||||
return (
|
||||
<li key={`${item.kind}-${item.id}`} className="flex items-start gap-2 px-4 py-2.5">
|
||||
<li key={`${item.kind}-${item.id}`} className="flex items-start gap-2 px-card py-2.5">
|
||||
<Icon size={14} className="mt-0.5 shrink-0 text-ink-3" aria-hidden="true" />
|
||||
<span className={cx('text-label text-ink line-clamp-2', item.is_done && 'line-through opacity-50')}>{item.body}</span>
|
||||
</li>
|
||||
|
||||
@@ -112,7 +112,7 @@ export default function OrderDialog({ orderId, tableName, onClose, onOpenFull })
|
||||
<div className="grid gap-3 -mx-2" data-testid="order-dialog">
|
||||
{order.waiters.length > 0 && (
|
||||
<div className="flex flex-wrap items-center gap-2 px-2">
|
||||
<span className="text-caption font-semibold uppercase tracking-wide text-ink-3">{t('overview.order.staff')}</span>
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-3">{t('overview.order.staff')}</span>
|
||||
{order.waiters.map(w => <Pill key={w.waiter_id} tone="accent">{nameOf(w.waiter_id)}</Pill>)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { BarChart3, Eye, EyeOff, Lock, Play, Power } from 'lucide-react'
|
||||
import { errorMessage } from '@xenia/api'
|
||||
import { useCan, useModule } from '@xenia/access'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { Button, Dialog, IconButton, Spinner, cx } from '@xenia/ui'
|
||||
import { Button, Dialog, IconButton, Page, Spinner, cx } from '@xenia/ui'
|
||||
import client from '../../api/client'
|
||||
import { LicenseContext } from '../../shell/licenseContext'
|
||||
import { useLiveQuery } from '../../live/useLiveQuery'
|
||||
@@ -123,7 +123,7 @@ export default function OverviewPage() {
|
||||
if (tablesPending || ordersPending || dayPending) return <div className="p-6 flex justify-center"><Spinner /></div>
|
||||
|
||||
return (
|
||||
<div className="p-4 md:p-6 grid gap-5" data-testid="overview">
|
||||
<Page testId="overview">
|
||||
<header className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="grid gap-1">
|
||||
<Pill tone={dayOpen ? 'success' : 'neutral'} className="justify-self-start uppercase tracking-wide" data-testid="day-state" data-open={dayOpen}>
|
||||
@@ -171,7 +171,7 @@ export default function OverviewPage() {
|
||||
onMessage={s => setMessage({ id: s.waiter_id, name: s.waiter_name })} />
|
||||
<TablesCard cards={cards} onOpen={(id, table) => setOrder({ id, table })} />
|
||||
<Card title={t('overview.revenueByHour')} testId="revenue-chart">
|
||||
<div className="p-4"><HourBars buckets={hourBuckets(orderPairs(today), hourOf)} current={nowHour} /></div>
|
||||
<div className="p-card"><HourBars buckets={hourBuckets(orderPairs(today), hourOf)} current={nowHour} /></div>
|
||||
</Card>
|
||||
</div>
|
||||
<div className="grid gap-5 min-w-0">
|
||||
@@ -198,14 +198,14 @@ export default function OverviewPage() {
|
||||
</div>
|
||||
</Dialog>
|
||||
)}
|
||||
</div>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
|
||||
function Kpi({ label, sub, pct, tone, children }) {
|
||||
return (
|
||||
<div className={cx('rounded-card border bg-surface shadow-raised p-4 grid gap-1 content-start', tone === 'warning' ? 'border-warning' : 'border-line')}>
|
||||
<span className="text-caption font-semibold uppercase tracking-wide text-ink-2">{label}</span>
|
||||
<div className={cx('rounded-card border bg-surface shadow-raised p-card grid gap-1 content-start', tone === 'warning' ? 'border-warning' : 'border-line')}>
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-2">{label}</span>
|
||||
<span className="text-display font-bold tabular-nums text-ink leading-tight">{children}</span>
|
||||
{sub && <span className="text-label text-ink-2">{sub}</span>}
|
||||
{pct != null && (
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function ShiftDialog({ shift, mode, onClose, onConfirm, busy }) {
|
||||
{screen === 'overview' && (<>
|
||||
<div className={cx('rounded-card border p-4 flex flex-wrap items-center justify-between gap-3', SOFT.success, 'border-success')}>
|
||||
<div className="grid">
|
||||
<span className="text-caption font-semibold uppercase tracking-wide">{t('overview.shift.expected')}</span>
|
||||
<span className="text-overline font-semibold uppercase tracking-wide">{t('overview.shift.expected')}</span>
|
||||
<Money value={money.expected} className="text-display font-bold text-ink" data-testid="shift-expected" />
|
||||
</div>
|
||||
<div className="text-label text-right">
|
||||
@@ -106,7 +106,7 @@ export default function ShiftDialog({ shift, mode, onClose, onConfirm, busy }) {
|
||||
{data.activity && <ShiftActivity a={data.activity} money={money} />}
|
||||
{summary && shiftPairs(summary).length > 0 && (
|
||||
<div className="grid gap-2">
|
||||
<span className="text-caption font-semibold uppercase tracking-wide text-ink-3">{t('overview.shift.perHour')}</span>
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-3">{t('overview.shift.perHour')}</span>
|
||||
<HourBars buckets={hourBuckets(shiftPairs(summary), hourOf, { from: 24, to: -1 })} height="h-16" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -19,11 +19,11 @@ export default function ShiftsCard({ shifts, idle, dayOpen, hidden, onStart, onE
|
||||
return (
|
||||
<Card title={t('overview.shifts.title')} testId="shifts-card"
|
||||
action={dayOpen && idle.length > 0 && <Button size="sm" variant="secondary" icon={<Plus size={16} />} onClick={() => setStarting(true)} data-testid="shift-start">{t('overview.shifts.start')}</Button>}>
|
||||
<div className="p-3 grid gap-2">
|
||||
<div className="p-card grid gap-2">
|
||||
{shifts.length === 0 ? <EmptyState compact title={t('overview.shifts.none')} /> : shifts.map(s => {
|
||||
const onBreak = Array.isArray(s.breaks) ? s.breaks.find(b => !b.ended_at) : null
|
||||
return (
|
||||
<div key={s.id} className={cx('flex items-center gap-3 p-2.5 rounded-card border', onBreak ? 'border-warning bg-warning-soft' : 'border-line bg-surface-2')} data-testid="shift-row">
|
||||
<div key={s.id} className={cx('flex items-center gap-3 px-3.5 py-3 rounded-card border', onBreak ? 'border-warning bg-warning-soft' : 'border-line bg-surface-2')} data-testid="shift-row">
|
||||
<Avatar name={s.waiter_name} url={s.avatar_url} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function TablesCard({ cards, onOpen }) {
|
||||
return (
|
||||
<Card title={t('overview.tables.title')} testId="tables-card"
|
||||
action={<Button size="sm" variant="ghost" iconEnd={<ArrowRight size={16} />} onClick={() => navigate('/tables')}>{t('overview.tables.all')}</Button>}>
|
||||
<div className="p-4 grid gap-3">
|
||||
<div className="p-card grid gap-3">
|
||||
<div className="grid gap-2 grid-cols-[repeat(auto-fill,minmax(3.5rem,1fr))]">
|
||||
{cards.map(({ table, order, state }) => (
|
||||
<button key={table.id} type="button" disabled={!order}
|
||||
|
||||
@@ -9,7 +9,7 @@ export function Card({ title, info, action, children, className, testId, tone })
|
||||
return (
|
||||
<section className={cx('rounded-card border bg-surface shadow-raised overflow-hidden', tone ? BORDER[tone] : 'border-line', className)} data-testid={testId}>
|
||||
{(title || action) && (
|
||||
<header className={cx('flex items-center gap-2 px-4 py-3 border-b', tone ? `${SOFT[tone]} ${BORDER[tone]}` : 'border-line')}>
|
||||
<header className={cx('flex items-center gap-2 px-card py-card-y border-b', tone ? `${SOFT[tone]} ${BORDER[tone]}` : 'border-line')}>
|
||||
<h2 className="flex-1 min-w-0 text-body-lg font-semibold flex items-center gap-1">{title}{info}</h2>
|
||||
{action}
|
||||
</header>
|
||||
@@ -69,7 +69,7 @@ export function HourBars({ buckets, current, height = 'h-24', testId }) {
|
||||
export function Figure({ label, children, sub, className }) {
|
||||
return (
|
||||
<div className={cx('grid gap-0.5', className)}>
|
||||
<span className="text-caption font-semibold uppercase tracking-wide text-ink-3">{label}</span>
|
||||
<span className="text-overline font-semibold uppercase tracking-wide text-ink-3">{label}</span>
|
||||
<span className="text-title font-semibold tabular-nums text-ink">{children}</span>
|
||||
{sub && <span className="text-caption text-ink-3">{sub}</span>}
|
||||
</div>
|
||||
|
||||
@@ -6,11 +6,12 @@ export const SOFT = {
|
||||
info: 'bg-info-soft text-info-ink',
|
||||
warning: 'bg-warning-soft text-warning-ink',
|
||||
danger: 'bg-danger-soft text-danger-ink',
|
||||
special: 'bg-special-soft text-special-ink',
|
||||
neutral: 'bg-surface-2 text-ink-2',
|
||||
}
|
||||
export const SOLID = {
|
||||
accent: 'bg-accent', success: 'bg-success', info: 'bg-info', warning: 'bg-warning', danger: 'bg-danger', neutral: 'bg-ink-3',
|
||||
accent: 'bg-accent', success: 'bg-success', info: 'bg-info', warning: 'bg-warning', danger: 'bg-danger', special: 'bg-special', neutral: 'bg-ink-3',
|
||||
}
|
||||
export const BORDER = {
|
||||
accent: 'border-accent', success: 'border-success', info: 'border-info', warning: 'border-warning', danger: 'border-danger', neutral: 'border-line',
|
||||
accent: 'border-accent', success: 'border-success', info: 'border-info', warning: 'border-warning', danger: 'border-danger', special: 'border-special', neutral: 'border-line',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user