feat(manager): the venue's online ordering link and QR code on the Online ordering page

Plan phase 3S, step S.99.
- GET /api/connect/fees returns `links` {order, menu}: the ordering app and QR menu
  addresses, from the cloud's apps_url (heartbeat) and the site id.
- Manager: "Your ordering link" card (OrderingLink.jsx) on Online ordering: the address, its
  QR code, copy / open / print, to share or put on the website and window.
- Pack README: routers/fees.py row.
- Tests: the link (backend), the card (manager e2e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 01:36:02 +02:00
co-authored by Claude Opus 5.5
parent 652e6a26af
commit 18d580d87c
8 changed files with 66 additions and 1 deletions
@@ -14,6 +14,7 @@ import { SALES_POINTS } from '@xenia/access'
import { Button, Dialog, EmptyState, Field, IconButton, Input, Select, Spinner, Switch } from '@xenia/ui'
import client from '../../api/client'
import FeeProductCard from './FeeProductCard'
import OrderingLink from './OrderingLink'
import OrderingSettings from './OrderingSettings'
import { ACTIONS, DAYS, describeRule, emptyRule, moveRule, parsePostcodes, previewBody, ruleBody, ruleProblems, ruleToForm } from './feesLogic'
@@ -57,6 +58,8 @@ export default function FeesPage() {
<h1 className="text-heading font-semibold text-ink">{t('ordering.pageTitle')}</h1>
</header>
{data.links?.order && <OrderingLink url={data.links.order} />}
<OrderingSettings key={JSON.stringify(data.ordering)} ordering={data.ordering} />
<div className="grid gap-1">
@@ -0,0 +1,31 @@
// The venue's online ordering link (plan phase 3S, wrap-up): the address of its ordering app
// (takeaway, delivery, table bookings) to share, put on the website or social pages, or print
// 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'
export default function OrderingLink({ url }) {
const { t } = useTranslation('manager')
const copy = async () => {
try { await navigator.clipboard.writeText(url); toast.success(t('orderingLink.copied')) } catch { toast.error(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>
<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>
<a href={url} target="_blank" rel="noreferrer" className="text-body font-medium text-accent-ink break-all" data-testid="ordering-link-url">{url}</a>
<div className="flex flex-wrap gap-2 print:hidden">
<Button size="sm" variant="secondary" icon={<Copy size={14} />} onClick={copy}>{t('orderingLink.copy')}</Button>
<Button size="sm" variant="secondary" icon={<ExternalLink size={14} />} onClick={() => window.open(url, '_blank', 'noopener')}>{t('orderingLink.open')}</Button>
<Button size="sm" variant="secondary" icon={<Printer size={14} />} onClick={() => window.print()}>{t('orderingLink.print')}</Button>
</div>
</div>
</section>
)
}