@@ -82,6 +88,8 @@ function Shell() {
))}
+ {/* Outside .sidebar-foot so it also shows on mobile (the Pi has no screen). */}
+
@@ -112,12 +120,14 @@ function Shell() {
{view === 'activity' && }
{view === 'raffle' && }
{view === 'badges' && }
+ {view === 'printing' && }
{view === 'events' && }
{view === 'interfaces' && }
{view === 'reports' && }
{view === 'settings' && }
+
);
}
diff --git a/apps/admin/src/components/BadgeRender.tsx b/apps/admin/src/components/BadgeRender.tsx
index 3855235..f0322aa 100644
--- a/apps/admin/src/components/BadgeRender.tsx
+++ b/apps/admin/src/components/BadgeRender.tsx
@@ -1,5 +1,6 @@
import { QRCodeSVG } from 'qrcode.react';
import type { BadgeElement, BadgeQrElement, BadgeSample, BadgeTextElement } from '../lib/types';
+import './badge-render.css';
// CSS 96 dpi: 1mm = 3.7795px. Shared by the editor canvas and read-only previews.
export const MM = 3.7795275591;
@@ -45,7 +46,7 @@ export function resolveText(el: BadgeTextElement, sample: BadgeSample): string {
export function resolveQr(el: BadgeQrElement, sample: BadgeSample): string {
switch (el.value) {
case 'qr_token': return sample.qr_token || 'CONVIVO-QR';
- case 'checkin_url': return `${window.location.origin}/checkin/${sample.qr_token || 'TOKEN'}`;
+ case 'checkin_url': return `${sample.checkin_origin ?? window.location.origin}/checkin/${sample.qr_token || 'TOKEN'}`;
case 'email': return sample.email || 'attendee@example.com';
case 'attendee_name': return sample.full_name || 'Attendee';
default: return el.static_value || 'https://example.com';
diff --git a/apps/admin/src/components/PrinterStatusPill.tsx b/apps/admin/src/components/PrinterStatusPill.tsx
new file mode 100644
index 0000000..41b9d6e
--- /dev/null
+++ b/apps/admin/src/components/PrinterStatusPill.tsx
@@ -0,0 +1,54 @@
+import type { View } from '../App';
+import { Tooltip } from './ui';
+import { activeStations, aggregateState, printerHint, timeAgo, shortError, usePrintStatus, worstStation } from '../lib/printStatus';
+import type { PrintStation, PrintStationState } from '../lib/types';
+
+// Pill label per aggregated state; the worst station refines error/offline text.
+function pillText(state: PrintStationState | 'none', station: PrintStation | null): string {
+ if (state === 'none') return 'No printer';
+ if (state === 'ready') return 'Printer ready';
+ if (state === 'printing') return 'Printing…';
+ if (state === 'offline') return `Printer offline · ${timeAgo(station?.last_seen_at)}`;
+ const err = station?.last_status?.printer?.errors?.[0];
+ return err ? `Printer: ${shortError(err)}` : 'Printer error';
+}
+
+function tooltipContent(stations: PrintStation[]): string {
+ return stations
+ .map((s) => {
+ const st = s.last_status;
+ const roll = st?.printer?.label_id ?? 'unknown roll';
+ const net = st?.network;
+ const netText = net?.ssid ? `${net.ssid}${net.ip ? ` · ${net.ip}` : ''}` : net?.state ?? 'unknown';
+ const hint = printerHint(s);
+ return `${s.name} (${s.state}) — roll: ${roll} · network: ${netText} · last seen: ${timeAgo(s.last_seen_at)}${hint ? ` · ${hint}` : ''}`;
+ })
+ .join('\n');
+}
+
+/**
+ * Always-visible printer status for the sidebar (desktop and mobile). The Pi
+ * has no screen, so staff must see the printer state from every admin view.
+ */
+export function PrinterStatusPill({ onNavigate }: { onNavigate: (view: View) => void }) {
+ const { overview } = usePrintStatus();
+ const stations = activeStations(overview);
+ const state = aggregateState(stations);
+ const station = worstStation(stations);
+ const label = pillText(state, station);
+
+ return (
+
{tooltipContent(stations)}}>
+
+
+ );
+}
diff --git a/apps/admin/src/components/badge-render.css b/apps/admin/src/components/badge-render.css
new file mode 100644
index 0000000..fb1bbd2
--- /dev/null
+++ b/apps/admin/src/components/badge-render.css
@@ -0,0 +1,586 @@
+/*
+ * Badge rendering: the read-only badge rules shared by the admin preview and the
+ * standalone print renderer (apps/admin/print.html). Imported by BadgeRender.tsx,
+ * so the admin app loads this before styles.css.
+ */
+
+/* Bundled fonts. The editor family names below are the ones BadgeEditor offers;
+ each maps to an open-licensed metric-compatible face so rendering never depends
+ on the fonts installed on the viewer's OS (admin laptop vs. the Pi). */
+/* Open Sans latin 400 normal (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 400 normal (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 700 normal (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 700 normal (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 400 italic (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 400 italic (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 700 italic (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 700 italic (editor family "Open Sans") */
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 400 normal (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 400 normal (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 700 normal (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 700 normal (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 400 italic (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 400 italic (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 700 italic (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 700 italic (editor family "Helvetica") */
+@font-face {
+ font-family: 'Helvetica';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 400 normal (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 400 normal (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 700 normal (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 700 normal (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 400 italic (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 400 italic (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Arimo latin 700 italic (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Arimo latin-ext 700 italic (editor family "Arial") */
+@font-face {
+ font-family: 'Arial';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/arimo/files/arimo-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Gelasio latin 400 normal (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Gelasio latin-ext 400 normal (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Gelasio latin 700 normal (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Gelasio latin-ext 700 normal (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Gelasio latin 400 italic (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Gelasio latin-ext 400 italic (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Gelasio latin 700 italic (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Gelasio latin-ext 700 italic (editor family "Georgia") */
+@font-face {
+ font-family: 'Georgia';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/gelasio/files/gelasio-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Tinos latin 400 normal (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Tinos latin-ext 400 normal (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Tinos latin 700 normal (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Tinos latin-ext 700 normal (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Tinos latin 400 italic (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Tinos latin-ext 400 italic (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Tinos latin 700 italic (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Tinos latin-ext 700 italic (editor family "Times New Roman") */
+@font-face {
+ font-family: 'Times New Roman';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/tinos/files/tinos-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Cousine latin 400 normal (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Cousine latin-ext 400 normal (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Cousine latin 700 normal (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Cousine latin-ext 700 normal (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Cousine latin 400 italic (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Cousine latin-ext 400 italic (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Cousine latin 700 italic (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Cousine latin-ext 700 italic (editor family "Courier New") */
+@font-face {
+ font-family: 'Courier New';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/cousine/files/cousine-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 400 normal (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-400-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 400 normal (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: normal;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-400-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 700 normal (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-700-normal.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 700 normal (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: normal;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-700-normal.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 400 italic (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-400-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 400 italic (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: italic;
+ font-weight: 400;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-400-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* Open Sans latin 700 italic (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-700-italic.woff2) format('woff2');
+ unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
+}
+
+/* Open Sans latin-ext 700 italic (editor family "system-ui") */
+@font-face {
+ font-family: 'system-ui';
+ font-style: italic;
+ font-weight: 700;
+ font-display: block;
+ src: url(@fontsource/open-sans/files/open-sans-latin-ext-700-italic.woff2) format('woff2');
+ unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
+}
+
+/* ---------- badge page (read-only rendering) ---------- */
+.badge-page {
+ position: relative; background: #fff; flex: none;
+ touch-action: none;
+}
+.badge-page-static { flex: none; }
+.badge-el { position: absolute; overflow: visible; }
+.badge-text-body { width: 100%; height: 100%; display: flex; overflow: hidden; }
+.badge-text-body > span { width: 100%; overflow-wrap: anywhere; }
+.badge-el-placeholder { color: #cbd5e1; font-style: italic; }
+.badge-qr-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
+.badge-qr-body svg { width: 100%; height: 100%; }
+.badge-image-body { width: 100%; height: 100%; display: block; }
+.badge-image-empty {
+ display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px;
+ border: 1px dashed #cbd5e1; background: #f8fafc;
+}
diff --git a/apps/admin/src/lib/api.ts b/apps/admin/src/lib/api.ts
index 36c95f0..1f724ad 100644
--- a/apps/admin/src/lib/api.ts
+++ b/apps/admin/src/lib/api.ts
@@ -16,6 +16,7 @@ import type {
PointsLogRow,
PretixOptions,
PretixSyncResult,
+ PrintOverview,
RafflePoolEntry,
RaffleWinner,
Registration,
@@ -491,3 +492,34 @@ export const generateFeedbackSummary = (eventId: string, sessionId?: string) =>
method: 'POST',
body: JSON.stringify({ event_id: eventId, scope: sessionId ? 'session' : 'event', ...(sessionId ? { session_id: sessionId } : {}) }),
});
+
+// ---- Badge printing (queue + printer stations) -------------------------------
+
+/** Admin dashboard snapshot: stations, queue counters, recent jobs, dead letters. */
+export const getPrintOverview = () => rpc
('get_print_overview', {});
+
+/** Queue one attendee's badge for printing; resolves with the queue msg id. */
+export const enqueueBadgePrint = (registrationId: string) =>
+ rpc('enqueue_badge_print', { p_registration_id: registrationId });
+
+/** Register a printer station. The token is returned only here, never again. */
+export async function createPrintStation(name: string): Promise<{ id: string; token: string }> {
+ // create_print_station returns a one-row table (a JSON array of one object).
+ const rows = await rpc<{ id: string; token: string }[]>('create_print_station', { p_name: name });
+ if (!rows[0]) throw new ApiError('Station creation returned no token');
+ return rows[0];
+}
+
+/** Retire a station; its token stops working immediately. */
+export const revokePrintStation = (id: string) => rpc('revoke_print_station', { p_id: id });
+
+/** Rename a station (revoked ones included); the Pi adopts the new name. */
+export const renamePrintStation = (id: string, name: string) =>
+ rpc('rename_print_station', { p_id: id, p_name: name });
+
+/** Push a dead letter back onto the live queue; resolves with the new msg id. */
+export const requeueDeadBadgePrint = (msgId: number) =>
+ rpc('requeue_dead_badge_print', { p_msg_id: msgId });
+
+/** Drop a dead letter without retrying it. */
+export const discardDeadBadgePrint = (msgId: number) => rpc('discard_dead_badge_print', { p_msg_id: msgId });
diff --git a/apps/admin/src/lib/printStatus.tsx b/apps/admin/src/lib/printStatus.tsx
new file mode 100644
index 0000000..4e6d106
--- /dev/null
+++ b/apps/admin/src/lib/printStatus.tsx
@@ -0,0 +1,136 @@
+import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactNode } from 'react';
+import { getPrintOverview } from './api';
+import type { PrintOverview, PrintStation, PrintStationState } from './types';
+
+const POLL_MS = 5000;
+
+interface PrintStatusState {
+ overview: PrintOverview | null;
+ error: string | null;
+ refresh: () => Promise;
+}
+
+const PrintStatusContext = createContext(null);
+
+/**
+ * Single shared poller for the badge-print overview, mounted once for the
+ * authenticated admin shell. Polls every 5 s while the document is visible,
+ * pauses when hidden and refreshes immediately on visibilitychange. A failing
+ * poll keeps the last overview and only exposes the error.
+ */
+export function PrintStatusProvider({ children }: { children: ReactNode }) {
+ const [overview, setOverview] = useState(null);
+ const [error, setError] = useState(null);
+ const inflight = useRef(false);
+
+ const refresh = useCallback(async () => {
+ if (inflight.current) return;
+ inflight.current = true;
+ try {
+ const data = await getPrintOverview();
+ setOverview(data);
+ setError(null);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : 'Printer status unavailable');
+ } finally {
+ inflight.current = false;
+ }
+ }, []);
+
+ useEffect(() => {
+ let cancelled = false;
+ const tick = () => {
+ if (!cancelled && document.visibilityState === 'visible') void refresh();
+ };
+ tick();
+ const timer = window.setInterval(tick, POLL_MS);
+ const onVisible = () => {
+ if (document.visibilityState === 'visible') void refresh();
+ };
+ document.addEventListener('visibilitychange', onVisible);
+ return () => {
+ cancelled = true;
+ window.clearInterval(timer);
+ document.removeEventListener('visibilitychange', onVisible);
+ };
+ }, [refresh]);
+
+ return {children};
+}
+
+export function usePrintStatus(): PrintStatusState {
+ const ctx = useContext(PrintStatusContext);
+ if (!ctx) throw new Error('usePrintStatus must be used within PrintStatusProvider');
+ return ctx;
+}
+
+// ---- Pure helpers (shared by the pill, the Printing view and Registrations) --
+
+/** Stations that can still print; revoked ones are ignored everywhere. */
+export function activeStations(overview: PrintOverview | null): PrintStation[] {
+ return (overview?.stations ?? []).filter((s) => s.state !== 'revoked' && !s.revoked_at);
+}
+
+// Worst-state wins for the aggregated pill: error > offline > printing > ready.
+const SEVERITY: PrintStationState[] = ['error', 'offline', 'printing', 'ready'];
+
+export function aggregateState(stations: PrintStation[]): PrintStationState | 'none' {
+ for (const state of SEVERITY) if (stations.some((s) => s.state === state)) return state;
+ return 'none';
+}
+
+/** The station whose state drives the pill. */
+export function worstStation(stations: PrintStation[]): PrintStation | null {
+ const state = aggregateState(stations);
+ return stations.find((s) => s.state === state) ?? null;
+}
+
+/** Compact age for last_seen_at: "45 s", "2 min", "3 h", "1 d". */
+export function timeAgo(iso: string | null | undefined): string {
+ if (!iso) return 'never';
+ const secs = Math.max(0, Math.round((Date.now() - new Date(iso).getTime()) / 1000));
+ if (secs < 60) return `${secs} s`;
+ const mins = Math.floor(secs / 60);
+ if (mins < 60) return `${mins} min`;
+ const hours = Math.floor(mins / 60);
+ if (hours < 24) return `${hours} h`;
+ return `${Math.floor(hours / 24)} d`;
+}
+
+/** Trim Brother error strings to their core: 'No media when printing' → 'No media'. */
+export function shortError(err: string): string {
+ return err.replace(/\s+when\s+printing/i, '').replace(/\s*\(.*\)\s*$/, '').trim();
+}
+
+/**
+ * Staff-facing instruction for a station's current problem ('' when fine).
+ * The Pi has no screen, so this text is the only channel to the operator.
+ */
+export function printerHint(station: PrintStation): string {
+ const st = station.last_status;
+ const wifiHint = () => {
+ const ssid = st?.network?.ssid?.trim();
+ const network = ssid ? `“${ssid}”` : '“Convivo-Printer-XXXX”';
+ return `The printer is not reachable. If it moved to a new Wi-Fi network, connect a phone to the open Wi-Fi ${network} and open http://10.41.0.1 to choose the network. Otherwise check the Raspberry Pi power.`;
+ };
+ if (station.state === 'offline') return wifiHint();
+ if (station.state === 'error') {
+ const printer = st?.printer;
+ if (printer && printer.connected === false) {
+ return 'Printer not detected — check the USB cable and that the printer is switched on.';
+ }
+ const errors = printer?.errors ?? [];
+ for (const err of errors) {
+ if (/wrong roll/i.test(err)) return err;
+ if (/cover open/i.test(err)) return 'Close the printer cover.';
+ if (/media/i.test(err)) return 'Load a new label roll.';
+ if (/cutter jam/i.test(err)) return 'Clear the cutter jam.';
+ }
+ if (errors.length > 0) return errors.join(' · ');
+ if (st?.last_error) return st.last_error;
+ return 'The printer reports a problem — check the station card below.';
+ }
+ // HOTSPOT on a live heartbeat means the Pi just lost its network.
+ if (st?.network?.state === 'HOTSPOT') return wifiHint();
+ return '';
+}
diff --git a/apps/admin/src/lib/types.ts b/apps/admin/src/lib/types.ts
index 486dee7..b928eb6 100644
--- a/apps/admin/src/lib/types.ts
+++ b/apps/admin/src/lib/types.ts
@@ -431,4 +431,104 @@ export interface BadgeSample {
qr_token: string;
event_name: string;
company: string;
+ /** Origin used to build check-in URLs; defaults to the current page origin. */
+ checkin_origin?: string;
+}
+
+/** The payload handed to the standalone print renderer (`window.renderBadge`). */
+export interface BadgePrintPayload {
+ schema: 'convivo.badge-print/v1';
+ kind: 'checkin' | 'reprint';
+ requested_at: string;
+ requested_by: string | null;
+ event: { id: string; name: string; company: string | null };
+ registration: { id: string; email: string; type: string };
+ sample: BadgeSample;
+ layout: {
+ id: string;
+ name: string;
+ page_width_mm: number;
+ page_height_mm: number;
+ elements: BadgeElement[];
+ };
+}
+
+// ---- Badge printing (queue + stations, `get_print_overview`) ----------------
+
+/** Derived station state (`get_print_overview` computes it server-side). */
+export type PrintStationState = 'ready' | 'printing' | 'error' | 'offline' | 'revoked';
+
+/** The `last_status` heartbeat the Raspberry Pi worker writes every 10 s. */
+export interface PrintStationStatus {
+ version?: string;
+ station_name?: string;
+ worker?: 'starting' | 'idle' | 'printing' | 'paused';
+ job_msg_id?: number | null;
+ printer?: {
+ connected?: boolean;
+ model?: string | null;
+ ready?: boolean;
+ media_type?: 'die-cut' | 'continuous' | null;
+ label_id?: string | null;
+ media_width_mm?: number | null;
+ media_length_mm?: number | null;
+ errors?: string[];
+ };
+ network?: {
+ state?: 'CONNECTED' | 'CONNECTING' | 'HOTSPOT' | 'UNKNOWN';
+ ssid?: string | null;
+ ip?: string | null;
+ };
+ label?: string | null;
+ last_error?: string | null;
+ uptime_s?: number;
+}
+
+export interface PrintStation {
+ id: string;
+ name: string;
+ created_at: string;
+ revoked_at: string | null;
+ last_seen_at: string | null;
+ last_status: PrintStationStatus | null;
+ state: PrintStationState;
+}
+
+export interface PrintQueueCounts {
+ pending: number;
+ in_flight: number;
+ dead_letter: number;
+ completed: number;
+}
+
+/** A completed (archived) badge job, newest first. */
+export interface PrintRecentJob {
+ msg_id: number;
+ archived_at: string;
+ kind: 'checkin' | 'reprint' | string;
+ full_name: string | null;
+ email: string | null;
+ event_name: string | null;
+ registration_id: string | null;
+}
+
+/** A job that kept failing and was moved to the dead letter queue. */
+export interface PrintDeadLetter {
+ msg_id: number;
+ enqueued_at: string;
+ failed_at: string | null;
+ error: string | null;
+ attempts: string | number | null;
+ kind: 'checkin' | 'reprint' | string;
+ full_name: string | null;
+ email: string | null;
+ event_name: string | null;
+ registration_id: string | null;
+}
+
+export interface PrintOverview {
+ stations: PrintStation[];
+ queue: PrintQueueCounts;
+ recent: PrintRecentJob[];
+ dead_letters: PrintDeadLetter[];
}
diff --git a/apps/admin/src/print/main.tsx b/apps/admin/src/print/main.tsx
new file mode 100644
index 0000000..e323530
--- /dev/null
+++ b/apps/admin/src/print/main.tsx
@@ -0,0 +1,77 @@
+import { flushSync } from 'react-dom';
+import { createRoot, type Root } from 'react-dom/client';
+import { BadgePagePreview, MM } from '../components/BadgeRender';
+import type { BadgePrintPayload } from '../lib/types';
+
+declare global {
+ interface Window {
+ /** Render one badge; resolves with its size in CSS pixels. */
+ renderBadge: (
+ payload: BadgePrintPayload,
+ options?: { checkinOrigin?: string },
+ ) => Promise<{ width_px: number; height_px: number }>;
+ __badgeReady: boolean;
+ __badgeError: string | null;
+ }
+}
+
+const SCHEMA = 'convivo.badge-print/v1';
+
+let root: Root | null = null;
+
+function nextFrame(): Promise {
+ return new Promise((resolve) => requestAnimationFrame(() => resolve()));
+}
+
+/** Wait until every image inside the badge is decoded (rejects on a broken src). */
+async function waitForImages(host: HTMLElement): Promise {
+ const images = Array.from(host.querySelectorAll('img'));
+ for (const img of images) {
+ try {
+ await img.decode();
+ } catch {
+ throw new Error(`image failed to load: ${img.src || img.getAttribute('src') || ''}`);
+ }
+ }
+}
+
+async function renderBadge(
+ payload: BadgePrintPayload,
+ options?: { checkinOrigin?: string },
+): Promise<{ width_px: number; height_px: number }> {
+ window.__badgeReady = false;
+ window.__badgeError = null;
+ try {
+ if (!payload || payload.schema !== SCHEMA) {
+ throw new Error(`unsupported print payload schema: ${payload?.schema}`);
+ }
+ const host = document.getElementById('badge-root');
+ if (!host) throw new Error('badge-root element not found');
+ if (!root) root = createRoot(host);
+ flushSync(() => {
+ root?.render(
+ ,
+ );
+ });
+ await document.fonts.ready;
+ await waitForImages(host);
+ await nextFrame();
+ await nextFrame();
+ const page = host.querySelector('.badge-page');
+ if (!page) throw new Error('badge page did not render');
+ const box = page.getBoundingClientRect();
+ window.__badgeReady = true;
+ return { width_px: box.width, height_px: box.height };
+ } catch (err) {
+ window.__badgeError = err instanceof Error ? err.message : String(err);
+ throw err;
+ }
+}
+
+window.renderBadge = renderBadge;
+window.__badgeReady = false;
+window.__badgeError = null;
diff --git a/apps/admin/src/styles.css b/apps/admin/src/styles.css
index 3decb7e..2b032a4 100644
--- a/apps/admin/src/styles.css
+++ b/apps/admin/src/styles.css
@@ -462,33 +462,20 @@ table.data tr:hover td { background: rgba(244,245,249,.6); }
overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
padding: 28px; display: flex; justify-content: center; align-items: flex-start; min-height: 360px;
}
-.badge-page {
- position: relative; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.12); flex: none;
- touch-action: none;
-}
+/* Editor-only look; the shared read-only badge rules live in components/badge-render.css. */
+.badge-page { box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.badge-page-empty {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
color: #94a3b8; font-size: 13px; text-align: center; padding: 20px; pointer-events: none;
}
-.badge-el { position: absolute; overflow: visible; cursor: move; }
+.badge-el { cursor: move; }
.badge-el.selected { outline: 1.5px solid var(--accent); }
-.badge-text-body { width: 100%; height: 100%; display: flex; overflow: hidden; }
-.badge-text-body > span { width: 100%; overflow-wrap: anywhere; }
-.badge-el-placeholder { color: #cbd5e1; font-style: italic; }
.badge-align-group { margin-top: 8px; }
.badge-align-group-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.badge-preview-stage {
display: flex; justify-content: center; align-items: center; padding: 16px;
background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; min-height: 180px;
}
-.badge-page-static { flex: none; }
-.badge-qr-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
-.badge-qr-body svg { width: 100%; height: 100%; }
-.badge-image-body { width: 100%; height: 100%; display: block; }
-.badge-image-empty {
- display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px;
- border: 1px dashed #cbd5e1; background: #f8fafc;
-}
.badge-handle {
position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--accent);
border-radius: 2px; transform: translate(-50%, -50%); z-index: 2;
@@ -534,3 +521,49 @@ table.data tr:hover td { background: rgba(244,245,249,.6); }
.badge-guide-v { width: 0; border-left: 1px dashed #ff2d95; }
.badge-guide-h { height: 0; border-top: 1px dashed #ff2d95; }
.badge-guide-space { border-color: #0ea5e9; }
+
+/* Printing */
+.printer-pill {
+ display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 14px;
+ padding: 9px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.16);
+ background: var(--sidebar-2); color: rgba(255,255,255,.85);
+ font-size: 12.5px; font-weight: 700; font-family: inherit; cursor: pointer;
+ white-space: nowrap; flex-shrink: 0; text-align: left; transition: background .12s;
+}
+.printer-pill:hover { background: rgba(255,255,255,.1); color: #fff; }
+.printer-pill-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
+.printer-pill.ready { border-color: rgba(5,150,105,.55); }
+.printer-pill.ready .printer-pill-dot { background: #10b981; box-shadow: 0 0 8px rgba(16,185,129,.7); }
+.printer-pill.printing { border-color: rgba(14,165,233,.55); }
+.printer-pill.printing .printer-pill-dot { background: #0ea5e9; box-shadow: 0 0 8px rgba(14,165,233,.7); animation: printer-pulse 1.1s ease-in-out infinite; }
+.printer-pill.error { border-color: rgba(213,0,0,.6); }
+.printer-pill.error .printer-pill-dot { background: var(--red); box-shadow: 0 0 8px rgba(213,0,0,.7); }
+.printer-pill.offline .printer-pill-dot, .printer-pill.none .printer-pill-dot { background: #6b7280; }
+@keyframes printer-pulse { 50% { opacity: .35; } }
+@media (prefers-reduced-motion: reduce) {
+ .printer-pill.printing .printer-pill-dot { animation: none; }
+}
+@media (max-width: 760px) {
+ /* First in the scrolling top bar, so it never hides behind the wide nav.
+ The Tooltip wrapper (span.tip-anchor) is the real flex child. */
+ .sidebar > .tip-anchor:has(.printer-pill) { order: -1; flex-shrink: 0; }
+ .printer-pill { width: auto; margin-top: 0; padding: 8px 12px; }
+}
+.printing { display: grid; gap: 16px; align-content: start; }
+.print-counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
+.print-counter { text-align: center; padding: 14px 10px; }
+.print-counter .n { font-size: 24px; font-weight: 800; }
+.print-counter .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
+.print-station { display: grid; gap: 12px; }
+.print-station.revoked { opacity: .65; }
+.print-hint {
+ padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5;
+ background: rgba(213,0,0,.07); border: 1px solid rgba(213,0,0,.3); color: var(--red);
+}
+.print-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; margin: 0; }
+.print-details dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
+.print-details dd { font-size: 13.5px; overflow-wrap: anywhere; margin: 0; }
+.print-last-error { color: var(--red); }
+@media (max-width: 760px) {
+ .print-counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+}
diff --git a/apps/admin/src/views/Printing.tsx b/apps/admin/src/views/Printing.tsx
new file mode 100644
index 0000000..91f2811
--- /dev/null
+++ b/apps/admin/src/views/Printing.tsx
@@ -0,0 +1,425 @@
+import { useState } from 'react';
+import {
+ createPrintStation,
+ discardDeadBadgePrint,
+ enqueueBadgePrint,
+ renamePrintStation,
+ requeueDeadBadgePrint,
+ revokePrintStation,
+} from '../lib/api';
+import type { PrintDeadLetter, PrintRecentJob, PrintStation, PrintStationState } from '../lib/types';
+import { useToast } from '../context/ToastContext';
+import { Empty, Modal, Spinner } from '../components/ui';
+import { activeStations, printerHint, timeAgo, usePrintStatus } from '../lib/printStatus';
+
+const STATE_LABEL: Record = {
+ ready: 'ready',
+ printing: 'printing',
+ error: 'error',
+ offline: 'offline',
+ revoked: 'revoked',
+};
+const STATE_PILL: Record = {
+ ready: 'green',
+ printing: 'session',
+ error: 'red',
+ offline: 'attendee',
+ revoked: 'attendee',
+};
+
+const kindLabel = (kind: string) => (kind === 'checkin' ? 'check-in' : kind === 'reprint' ? 'reprint' : kind);
+
+function fmtUptime(secs: number | undefined): string {
+ if (secs == null || !Number.isFinite(secs)) return '—';
+ const h = Math.floor(secs / 3600);
+ const m = Math.floor((secs % 3600) / 60);
+ return h > 0 ? `${h}h ${m}m` : `${m}m`;
+}
+
+function fmtTime(iso: string | null): string {
+ if (!iso) return '—';
+ const d = new Date(iso);
+ return Number.isNaN(d.getTime()) ? iso : d.toLocaleString();
+}
+
+export function Printing() {
+ const { push } = useToast();
+ const { overview, error, refresh } = usePrintStatus();
+ const [adding, setAdding] = useState(false);
+ const [stationName, setStationName] = useState('');
+ const [creating, setCreating] = useState(false);
+ const [issuedToken, setIssuedToken] = useState<{ name: string; token: string } | null>(null);
+ const [copied, setCopied] = useState(false);
+ const [busyId, setBusyId] = useState(null);
+ const [renamingId, setRenamingId] = useState(null);
+ const [renameValue, setRenameValue] = useState('');
+ const [renaming, setRenaming] = useState(false);
+
+ if (error && !overview) {
+ return ;
+ }
+ if (!overview) {
+ return (
+
+
+
+ );
+ }
+
+ const stations = overview.stations;
+ const live = activeStations(overview);
+ const { queue } = overview;
+
+ async function addStation() {
+ const name = stationName.trim();
+ if (!name || creating) return;
+ setCreating(true);
+ try {
+ const { token } = await createPrintStation(name);
+ setIssuedToken({ name, token });
+ setStationName('');
+ setAdding(false);
+ await refresh();
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Could not create the station');
+ } finally {
+ setCreating(false);
+ }
+ }
+
+ async function revoke(station: PrintStation) {
+ if (!confirm(`Revoke "${station.name}"? Its token stops working immediately and the Raspberry Pi can no longer print.`)) return;
+ setBusyId(station.id);
+ try {
+ await revokePrintStation(station.id);
+ await refresh();
+ push('success', `Station "${station.name}" revoked`);
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Revoke failed');
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ function startRename(station: PrintStation) {
+ setRenamingId(station.id);
+ setRenameValue(station.name);
+ }
+
+ function cancelRename() {
+ setRenamingId(null);
+ setRenameValue('');
+ }
+
+ async function saveRename(station: PrintStation) {
+ const name = renameValue.trim();
+ if (!name || renaming) return;
+ setRenaming(true);
+ try {
+ await renamePrintStation(station.id, name);
+ await refresh();
+ push('success', `Station renamed to "${name}"`);
+ cancelRename();
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Rename failed');
+ } finally {
+ setRenaming(false);
+ }
+ }
+
+ async function requeue(dl: PrintDeadLetter) {
+ setBusyId(dl.msg_id);
+ try {
+ await requeueDeadBadgePrint(dl.msg_id);
+ await refresh();
+ push('success', 'Job requeued — the station will pick it up');
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Requeue failed');
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ async function discard(dl: PrintDeadLetter) {
+ if (!confirm(`Discard this dead job${dl.full_name ? ` for ${dl.full_name}` : ''}? It will not be printed.`)) return;
+ setBusyId(dl.msg_id);
+ try {
+ await discardDeadBadgePrint(dl.msg_id);
+ await refresh();
+ push('success', 'Dead job discarded');
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Discard failed');
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ async function reprint(job: PrintRecentJob) {
+ if (!job.registration_id) {
+ push('error', 'This job has no registration to reprint');
+ return;
+ }
+ setBusyId(job.msg_id);
+ try {
+ await enqueueBadgePrint(job.registration_id);
+ await refresh();
+ push('success', `Reprint queued for ${job.full_name ?? job.email ?? 'attendee'}`);
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Reprint failed');
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ async function copyToken() {
+ if (!issuedToken) return;
+ try {
+ await navigator.clipboard.writeText(issuedToken.token);
+ setCopied(true);
+ } catch {
+ push('error', 'Copy failed — select the token and copy it manually');
+ }
+ }
+
+ return (
+
+
+
+
Printing
+
Badge queue and printer stations. {error ? Status update failed: {error} : null}
+
+
+ {adding ? (
+ <>
+ setStationName(e.target.value)}
+ onKeyDown={(e) => e.key === 'Enter' && addStation()}
+ />
+
+
+ >
+ ) : (
+
+ )}
+
+
+
+
+
+
{queue.in_flight}
in progress
+
+
{queue.dead_letter}
dead letter
+
+
+
Stations
+ {live.length === 0 && stations.length === 0 && (
+
+
+
+ )}
+ {live.length === 0 && stations.length > 0 && (
+
+ )}
+ {live.map((s) => {
+ const st = s.last_status;
+ const hint = printerHint(s);
+ const printer = st?.printer;
+ const roll = printer?.label_id
+ ? `${printer.label_id}${printer.media_type ? ` · ${printer.media_type}` : ''}${
+ printer.media_width_mm ? ` · ${printer.media_width_mm}×${printer.media_length_mm ?? '∞'} mm` : ''
+ }`
+ : '—';
+ return (
+
+
+
+ {renamingId === s.id ? (
+
+ setRenameValue(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') void saveRename(s);
+ if (e.key === 'Escape') cancelRename();
+ }}
+ />
+
+
+
+ ) : (
+ <>
+ {s.name}
+ {STATE_LABEL[s.state]}
+ >
+ )}
+
+
+ last seen {timeAgo(s.last_seen_at)} ago
+ {renamingId !== s.id && (
+
+ )}
+
+
+
+ {hint &&
{hint}
}
+
+ - Worker
- {st?.worker ?? '—'}
+ - Current job
- {st?.job_msg_id ? `#${st.job_msg_id}` : '—'}
+ - Printer
- {printer?.model ?? '—'}
+ - Roll
- {roll}
+
+
- Errors
+ - {printer?.errors?.length ? printer.errors.join(' · ') : '—'}
+
+
+
- Network
+ - {st?.network ? `${st.network.state ?? '—'}${st.network.ssid ? ` · ${st.network.ssid}` : ''}${st.network.ip ? ` · ${st.network.ip}` : ''}` : '—'}
+
+ - Version
- {st?.version ?? '—'}
+ - Uptime
- {fmtUptime(st?.uptime_s)}
+ - Last error
- {st?.last_error ?? '—'}
+
+
+ );
+ })}
+ {stations.filter((s) => s.state === 'revoked').map((s) => (
+
+
+
+ {s.name}
+ revoked
+
+
revoked {fmtTime(s.revoked_at)}
+
+
+ ))}
+
+
Dead letters
+
+
+
+
+ | Attendee |
+ Event |
+ Error |
+ Attempts |
+ Failed at |
+ Actions |
+
+
+
+ {overview.dead_letters.map((dl) => (
+
+
+
+
+ {dl.full_name ?? '—'}
+ {dl.email ?? ''}
+
+
+ |
+ {dl.event_name ?? '—'} |
+ {dl.error ?? '—'} |
+ {dl.attempts ?? '—'} |
+ {fmtTime(dl.failed_at)} |
+
+
+
+
+
+ |
+
+ ))}
+
+
+ {overview.dead_letters.length === 0 && (
+
+ )}
+
+
+
Recently printed
+
+
+
+
+ | Attendee |
+ Kind |
+ Time |
+ Actions |
+
+
+
+ {overview.recent.map((job) => (
+
+
+
+
+ {job.full_name ?? '—'}
+ {job.email ?? ''}
+
+
+ |
+ {kindLabel(job.kind)} |
+ {fmtTime(job.archived_at)} |
+
+
+ |
+
+ ))}
+
+
+ {overview.recent.length === 0 && (
+
+ )}
+
+
+ {issuedToken && (
+
{ setIssuedToken(null); setCopied(false); }}
+ footer={
+
+ }
+ >
+
+ Store it in the Raspberry Pi setup now — it cannot be shown again.
+
+
+ e.target.select()} aria-label="Station token" />
+
+
+
+ )}
+
+ );
+}
diff --git a/apps/admin/src/views/Registrations.tsx b/apps/admin/src/views/Registrations.tsx
index 1d483d3..5c5e3c6 100644
--- a/apps/admin/src/views/Registrations.tsx
+++ b/apps/admin/src/views/Registrations.tsx
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import {
createRegistration,
deleteContacts,
+ enqueueBadgePrint,
getBadgeLayouts,
getAllContacts,
getAllEvents,
@@ -18,6 +19,7 @@ import { useToast } from '../context/ToastContext';
import { useAuth } from '../context/AuthContext';
import { Avatar, ColumnFilter, Empty, Modal, QrImage, Spinner, Toggle, Tooltip, TypeBadge, type ColumnFilterOption } from '../components/ui';
import { BadgePagePreview, fitScale } from '../components/BadgeRender';
+import { activeStations, aggregateState, usePrintStatus } from '../lib/printStatus';
const TYPES: RegistrationType[] = ['attendee', 'speaker', 'staff', 'sponsor'];
// Multi-select column filters are Excel-style: an empty selection means "all".
@@ -44,6 +46,10 @@ export function Registrations() {
const [mergeFor, setMergeFor] = useState(null);
const [badgeFor, setBadgeFor] = useState(null);
const [badgeLayouts, setBadgeLayouts] = useState([]);
+ const [printingIds, setPrintingIds] = useState>(new Set());
+ const { overview: printOverview } = usePrintStatus();
+ // Aggregated printer state, used only to phrase the enqueue toast honestly.
+ const printerState = aggregateState(activeStations(printOverview));
const [fType, setFType] = useState([]);
const [fTicket, setFTicket] = useState([]);
const [fCheckedIn, setFCheckedIn] = useState([]);
@@ -201,6 +207,25 @@ export function Registrations() {
}
}
+ // Queue this attendee's badge. Works while the printer is offline/error —
+ // the job simply prints once the station is back.
+ async function printBadge(r: Registration) {
+ if (printingIds.has(r.id)) return;
+ setPrintingIds((ids) => new Set(ids).add(r.id));
+ try {
+ await enqueueBadgePrint(r.id);
+ push('success', printerState === 'offline' || printerState === 'error' ? `Queued — printer is ${printerState}` : 'Sent to printer');
+ } catch (e) {
+ push('error', e instanceof Error ? e.message : 'Print failed');
+ } finally {
+ setPrintingIds((ids) => {
+ const next = new Set(ids);
+ next.delete(r.id);
+ return next;
+ });
+ }
+ }
+
if (error) return ;
if (!loaded)
return (
@@ -327,6 +352,17 @@ export function Registrations() {
)}
+ {badgeConfigured ? (
+
+ ) : (
+
+
+
+ )}
{!r.qr_token?.trim() && r.import_source === 'sessionize' && (