feat(ui): the QR card shared in @xenia/ui/qr (platform-v2 step 6.14c)
- QrCode (a QR on a light tile, optional caption; framed or not) in packages/ui, on its own subpath so only the apps that show one need qrcode.react (an optional peer); x-qr styles keep the code dark on light in dark themes - used by the terminal's customer display, the manager's online-ordering link, table QR codes and Settings' pairing QR (four copies of the same markup gone) - the money pad and the order line row stay where they are: the manager's payment is the phones' cash / card choice (no cash given, change or split) and its order lines are not the counter's cart lines, so neither has a second user; the signage slides keep their own QR (inline styles scaled to the TV) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
import { useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import toast from 'react-hot-toast'
|
||||
import { QRCodeSVG } from 'qrcode.react'
|
||||
import { Lock, LockOpen, QrCode, RefreshCw } from 'lucide-react'
|
||||
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 { QrCode } from '@xenia/ui/qr'
|
||||
import client from '../../../api/client'
|
||||
import { useLiveQuery } from '../../../live/useLiveQuery'
|
||||
import { Pill } from '../../overview/parts'
|
||||
@@ -67,7 +67,7 @@ export default function SystemSettings() {
|
||||
{status?.waiter_domain && (
|
||||
<SettingRow label={t('settings.system.oldDomain')} hint={t('settings.system.oldDomainHint')}>
|
||||
<span className="flex items-center gap-2 text-label font-mono break-all">{status.waiter_domain}
|
||||
<Button size="sm" variant="secondary" icon={<QrCode size={14} />} onClick={() => setQr({ url: status.waiter_domain })}>{t('settings.system.qr')}</Button>
|
||||
<Button size="sm" variant="secondary" icon={<QrIcon size={14} />} onClick={() => setQr({ url: status.waiter_domain })}>{t('settings.system.qr')}</Button>
|
||||
</span>
|
||||
</SettingRow>
|
||||
)}
|
||||
@@ -101,7 +101,7 @@ export default function SystemSettings() {
|
||||
<Dialog open size="sm" onClose={() => setQr(null)} title={t('settings.system.qrTitle')} description={qr.caption}
|
||||
footer={<Button variant="secondary" onClick={() => setQr(null)}>{t('settings.back')}</Button>}>
|
||||
<div className="grid justify-items-center gap-3" data-testid="system-qr">
|
||||
<div className="p-3 rounded-card bg-surface border border-line"><QRCodeSVG value={qr.url} size={220} /></div>
|
||||
<QrCode value={qr.url} size={220} />
|
||||
<p className="text-caption font-mono text-ink-2 break-all text-center">{qr.url}</p>
|
||||
</div>
|
||||
</Dialog>
|
||||
@@ -155,7 +155,7 @@ function LanAccess({ status, onQr }) {
|
||||
<SettingRow label={t('settings.lan.waiters')} hint={t('settings.lan.waitersHint')}>
|
||||
<span className="flex flex-wrap items-center gap-2">
|
||||
<span className="font-mono text-label text-ink break-all">http://{ip}</span>
|
||||
<Button size="sm" variant="secondary" icon={<QrCode size={14} />} data-testid="lan-qr"
|
||||
<Button size="sm" variant="secondary" icon={<QrIcon size={14} />} data-testid="lan-qr"
|
||||
onClick={() => onQr({ url: waiterPairUrl(ip, status?.site_id, status?.tls?.spki_sha256), caption: t('settings.lan.qrCaption') })}>{t('settings.system.qr')}</Button>
|
||||
</span>
|
||||
</SettingRow>
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// as a QR code for flyers and the shop window. GET /api/connect/fees → links.order (the cloud
|
||||
// tells the venue where the customer apps live: PUBLIC_APPS_URL, sent with the heartbeat).
|
||||
import toast from 'react-hot-toast'
|
||||
import { QRCodeSVG } from 'qrcode.react'
|
||||
import { Copy, ExternalLink, Printer } from 'lucide-react'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { Button } from '@xenia/ui'
|
||||
import { QrCode } from '@xenia/ui/qr'
|
||||
|
||||
export default function OrderingLink({ url }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -15,7 +15,7 @@ export default function OrderingLink({ url }) {
|
||||
}
|
||||
return (
|
||||
<section className="p-4 rounded-card border border-line bg-surface flex flex-wrap items-center gap-4 print:border-0" aria-labelledby="ordering-link-h" data-testid="ordering-link">
|
||||
<div className="bg-surface p-2 rounded-control border border-line"><QRCodeSVG value={url} size={112} includeMargin={false} /></div>
|
||||
<QrCode value={url} size={112} />
|
||||
<div className="grid gap-2 flex-1 min-w-[16rem]">
|
||||
<h2 id="ordering-link-h" className="text-title font-semibold text-ink">{t('orderingLink.title')}</h2>
|
||||
<p className="text-label text-ink-2">{t('orderingLink.intro')}</p>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
// Backend: /api/connect/qr (connect_menu.manage), services/table_qr.py.
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import toast from 'react-hot-toast'
|
||||
import { QRCodeSVG } from 'qrcode.react'
|
||||
import { Printer, RefreshCw } from 'lucide-react'
|
||||
import { errorMessage } from '@xenia/api'
|
||||
import { useTranslation } from '@xenia/i18n'
|
||||
import { Button, Dialog, EmptyState, Spinner, Switch } from '@xenia/ui'
|
||||
import { QrCode } from '@xenia/ui/qr'
|
||||
import client from '../../api/client'
|
||||
|
||||
export default function QrCodesPage() {
|
||||
@@ -60,7 +60,7 @@ export default function QrCodesPage() {
|
||||
<li key={tb.id} className="p-4 rounded-card border border-line bg-surface grid justify-items-center gap-2 break-inside-avoid" data-testid="qr-table" data-table={tb.id} data-url={tb.url}>
|
||||
<span className="text-title font-semibold text-ink">{t('qr.table', { name: tb.name })}</span>
|
||||
{tb.group && <span className="text-label text-ink-2">{tb.group}</span>}
|
||||
<QRCodeSVG value={tb.url} size={168} includeMargin={false} />
|
||||
<QrCode value={tb.url} size={168} framed={false} />
|
||||
<span className="text-caption text-ink-3 text-center">{t(data.ordering ? 'qr.scanOrder' : 'qr.scanRead')}</span>
|
||||
<Button size="sm" variant="ghost" icon={<RefreshCw size={14} />} disabled={busy} className="print:hidden"
|
||||
onClick={() => act(() => client.post(`/api/connect/qr/tables/${tb.id}/rotate`), t('qr.rotated', { name: tb.name }))}
|
||||
|
||||
Reference in New Issue
Block a user