feat(printer): badge print queue, Pi worker, captive-portal setup, admin printing view
- migration 20261018170000: pgmq badge_print/badge_print_dlq, print_stations, token-gated printer RPCs (claim/complete/fail/heartbeat), admin RPCs, welcome_checkin enqueue; badge_print_tests.sql (101 assertions) - apps/printer: Python worker (Playwright render -> brother_ql via pyusb), comitup captive-portal (Wi-Fi + HTTPS endpoint + anon key + token), arm64 image build + idempotent Pi setup/install scripts, 77 pytest - apps/admin: Printing view, station management/DLQ, global printer status pill, Print button on Registrations, standalone print renderer entry (print.html -> dist-print) with bundled fonts - docs: printing.md + architecture/schema/rpcs/tests/admin-app updates, apps/printer/AGENT.md operating manual - e2e: printing.spec.ts Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
0f3720d48a
commit
00c89c1b48
55 files changed
+7406
-29
No files matched your search
@@ -10,12 +10,15 @@ import { Schedule } from './views/Schedule';
|
||||
import { Activity } from './views/Activity';
|
||||
import { Raffle } from './views/Raffle';
|
||||
import { BadgeEditor } from './views/BadgeEditor';
|
||||
import { Printing } from './views/Printing';
|
||||
import { Events } from './views/Events';
|
||||
import { Interfaces } from './views/Interfaces';
|
||||
import { Reports } from './views/Reports';
|
||||
import { Settings } from './views/Settings';
|
||||
import { Settings as SettingsIcon } from 'lucide-react';
|
||||
import { Spinner } from './components/ui';
|
||||
import { PrinterStatusPill } from './components/PrinterStatusPill';
|
||||
import { PrintStatusProvider } from './lib/printStatus';
|
||||
|
||||
export type View =
|
||||
| 'dashboard'
|
||||
@@ -26,6 +29,7 @@ export type View =
|
||||
| 'activity'
|
||||
| 'raffle'
|
||||
| 'badges'
|
||||
| 'printing'
|
||||
| 'events'
|
||||
| 'interfaces'
|
||||
| 'reports'
|
||||
@@ -40,6 +44,7 @@ const NAV: { id: View; label: string; ico: string }[] = [
|
||||
{ id: 'activity', label: 'Activity', ico: '⚡' },
|
||||
{ id: 'raffle', label: 'Raffle', ico: '🎯' },
|
||||
{ id: 'badges', label: 'Badges', ico: '🎫' },
|
||||
{ id: 'printing', label: 'Printing', ico: '🖨️' },
|
||||
{ id: 'events', label: 'Events', ico: '📅' },
|
||||
{ id: 'interfaces', label: 'Interfaces', ico: '🔌' },
|
||||
{ id: 'reports', label: 'Reports', ico: '📤' },
|
||||
@@ -61,6 +66,7 @@ function Shell() {
|
||||
if (!contact) return <Login />;
|
||||
|
||||
return (
|
||||
<PrintStatusProvider>
|
||||
<div className="app">
|
||||
<aside className="sidebar">
|
||||
<div className="brand">
|
||||
@@ -82,6 +88,8 @@ function Shell() {
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
{/* Outside .sidebar-foot so it also shows on mobile (the Pi has no screen). */}
|
||||
<PrinterStatusPill onNavigate={setView} />
|
||||
<div className="sidebar-foot">
|
||||
<div className="admin-card">
|
||||
<span className="avatar" style={{ width: 36, height: 36, fontSize: 13, background: '#d50000' }}>
|
||||
@@ -112,12 +120,14 @@ function Shell() {
|
||||
{view === 'activity' && <Activity />}
|
||||
{view === 'raffle' && <Raffle />}
|
||||
{view === 'badges' && <BadgeEditor />}
|
||||
{view === 'printing' && <Printing />}
|
||||
{view === 'events' && <Events />}
|
||||
{view === 'interfaces' && <Interfaces />}
|
||||
{view === 'reports' && <Reports />}
|
||||
{view === 'settings' && <Settings />}
|
||||
</main>
|
||||
</div>
|
||||
</PrintStatusProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 || '[email protected]';
|
||||
case 'attendee_name': return sample.full_name || 'Attendee';
|
||||
default: return el.static_value || 'https://example.com';
|
||||
|
||||
@@ -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 (
|
||||
<Tooltip title="Printer status" content={<span style={{ whiteSpace: 'pre-line' }}>{tooltipContent(stations)}</span>}>
|
||||
<button
|
||||
type="button"
|
||||
className={`printer-pill ${state}`}
|
||||
data-testid="printer-pill"
|
||||
data-state={state}
|
||||
onClick={() => onNavigate('printing')}
|
||||
>
|
||||
<span className="printer-pill-dot" aria-hidden="true" />
|
||||
{label}
|
||||
</button>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<PrintOverview>('get_print_overview', {});
|
||||
|
||||
/** Queue one attendee's badge for printing; resolves with the queue msg id. */
|
||||
export const enqueueBadgePrint = (registrationId: string) =>
|
||||
rpc<number>('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<void>('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<void>('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<number>('requeue_dead_badge_print', { p_msg_id: msgId });
|
||||
|
||||
/** Drop a dead letter without retrying it. */
|
||||
export const discardDeadBadgePrint = (msgId: number) => rpc<void>('discard_dead_badge_print', { p_msg_id: msgId });
|
||||
@@ -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<void>;
|
||||
}
|
||||
|
||||
const PrintStatusContext = createContext<PrintStatusState | null>(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<PrintOverview | null>(null);
|
||||
const [error, setError] = useState<string | null>(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 <PrintStatusContext.Provider value={{ overview, error, refresh }}>{children}</PrintStatusContext.Provider>;
|
||||
}
|
||||
|
||||
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 '';
|
||||
}
|
||||
@@ -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[];
|
||||
}
|
||||
@@ -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<void> {
|
||||
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<void> {
|
||||
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(
|
||||
<BadgePagePreview
|
||||
layout={payload.layout}
|
||||
sample={{ ...payload.sample, checkin_origin: options?.checkinOrigin }}
|
||||
pxPerMm={MM}
|
||||
/>,
|
||||
);
|
||||
});
|
||||
await document.fonts.ready;
|
||||
await waitForImages(host);
|
||||
await nextFrame();
|
||||
await nextFrame();
|
||||
const page = host.querySelector<HTMLElement>('.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;
|
||||
+49
-16
@@ -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)); }
|
||||
}
|
||||
@@ -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<PrintStationState, string> = {
|
||||
ready: 'ready',
|
||||
printing: 'printing',
|
||||
error: 'error',
|
||||
offline: 'offline',
|
||||
revoked: 'revoked',
|
||||
};
|
||||
const STATE_PILL: Record<PrintStationState, string> = {
|
||||
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<string | number | null>(null);
|
||||
const [renamingId, setRenamingId] = useState<string | null>(null);
|
||||
const [renameValue, setRenameValue] = useState('');
|
||||
const [renaming, setRenaming] = useState(false);
|
||||
|
||||
if (error && !overview) {
|
||||
return <Empty icon="⚠️" text={error} />;
|
||||
}
|
||||
if (!overview) {
|
||||
return (
|
||||
<div className="loading-screen">
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<div className="printing">
|
||||
<div className="page-head">
|
||||
<div>
|
||||
<h1>Printing</h1>
|
||||
<div className="sub">Badge queue and printer stations. {error ? <span className="feedback-error">Status update failed: {error}</span> : null}</div>
|
||||
</div>
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
{adding ? (
|
||||
<>
|
||||
<input
|
||||
className="input"
|
||||
style={{ maxWidth: 220 }}
|
||||
placeholder="Station name…"
|
||||
value={stationName}
|
||||
autoFocus
|
||||
onChange={(e) => setStationName(e.target.value)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && addStation()}
|
||||
/>
|
||||
<button className="btn primary small" disabled={!stationName.trim() || creating} onClick={addStation}>
|
||||
{creating ? 'Creating…' : 'Create'}
|
||||
</button>
|
||||
<button className="btn small" onClick={() => { setAdding(false); setStationName(''); }}>
|
||||
Cancel
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<button className="btn" onClick={() => setAdding(true)}>+ Add station</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="print-counters">
|
||||
<div className="card print-counter"><div className="n">{queue.pending}</div><div className="l">pending</div></div>
|
||||
<div className="card print-counter"><div className="n">{queue.in_flight}</div><div className="l">in progress</div></div>
|
||||
<div className="card print-counter"><div className="n">{queue.completed}</div><div className="l">done</div></div>
|
||||
<div className="card print-counter"><div className="n">{queue.dead_letter}</div><div className="l">dead letter</div></div>
|
||||
</div>
|
||||
|
||||
<div className="section-head"><h2 className="h2">Stations</h2></div>
|
||||
{live.length === 0 && stations.length === 0 && (
|
||||
<div className="card">
|
||||
<Empty icon="🖨️" text='No printer stations yet. Add one, then put its token on the Raspberry Pi.' />
|
||||
</div>
|
||||
)}
|
||||
{live.length === 0 && stations.length > 0 && (
|
||||
<div className="card"><Empty icon="🖨️" text='All stations are revoked. Add a station to print again.' /></div>
|
||||
)}
|
||||
{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 (
|
||||
<div className="card print-station" key={s.id} data-testid={`station-${s.id}`}>
|
||||
<div className="row between" style={{ flexWrap: 'wrap', gap: 8 }}>
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
{renamingId === s.id ? (
|
||||
<span className="row" style={{ gap: 8 }}>
|
||||
<input
|
||||
className="input"
|
||||
style={{ maxWidth: 220 }}
|
||||
aria-label="Station name"
|
||||
value={renameValue}
|
||||
autoFocus
|
||||
onChange={(e) => setRenameValue(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') void saveRename(s);
|
||||
if (e.key === 'Escape') cancelRename();
|
||||
}}
|
||||
/>
|
||||
<button className="btn primary small" disabled={!renameValue.trim() || renaming} onClick={() => void saveRename(s)}>
|
||||
{renaming ? 'Saving…' : 'Save'}
|
||||
</button>
|
||||
<button className="btn small" disabled={renaming} onClick={cancelRename}>
|
||||
Cancel
|
||||
</button>
|
||||
</span>
|
||||
) : (
|
||||
<>
|
||||
<strong>{s.name}</strong>
|
||||
<span className={`pill ${STATE_PILL[s.state]}`}>{STATE_LABEL[s.state]}</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
<span className="muted small">last seen {timeAgo(s.last_seen_at)} ago</span>
|
||||
{renamingId !== s.id && (
|
||||
<button className="btn small" disabled={busyId === s.id || renaming} onClick={() => startRename(s)}>
|
||||
Rename
|
||||
</button>
|
||||
)}
|
||||
<button className="btn danger small" disabled={busyId === s.id} onClick={() => revoke(s)}>
|
||||
Revoke
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{hint && <div className="print-hint" role="note">{hint}</div>}
|
||||
<dl className="print-details">
|
||||
<div><dt>Worker</dt><dd>{st?.worker ?? '—'}</dd></div>
|
||||
<div><dt>Current job</dt><dd>{st?.job_msg_id ? `#${st.job_msg_id}` : '—'}</dd></div>
|
||||
<div><dt>Printer</dt><dd>{printer?.model ?? '—'}</dd></div>
|
||||
<div><dt>Roll</dt><dd>{roll}</dd></div>
|
||||
<div>
|
||||
<dt>Errors</dt>
|
||||
<dd>{printer?.errors?.length ? printer.errors.join(' · ') : '—'}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Network</dt>
|
||||
<dd>{st?.network ? `${st.network.state ?? '—'}${st.network.ssid ? ` · ${st.network.ssid}` : ''}${st.network.ip ? ` · ${st.network.ip}` : ''}` : '—'}</dd>
|
||||
</div>
|
||||
<div><dt>Version</dt><dd>{st?.version ?? '—'}</dd></div>
|
||||
<div><dt>Uptime</dt><dd>{fmtUptime(st?.uptime_s)}</dd></div>
|
||||
<div><dt>Last error</dt><dd className="print-last-error">{st?.last_error ?? '—'}</dd></div>
|
||||
</dl>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{stations.filter((s) => s.state === 'revoked').map((s) => (
|
||||
<div className="card print-station revoked" key={s.id}>
|
||||
<div className="row between">
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
<strong>{s.name}</strong>
|
||||
<span className="pill attendee">revoked</span>
|
||||
</div>
|
||||
<span className="muted small">revoked {fmtTime(s.revoked_at)}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
<div className="section-head"><h2 className="h2">Dead letters</h2></div>
|
||||
<div className="table-wrap">
|
||||
<table className="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attendee</th>
|
||||
<th>Event</th>
|
||||
<th>Error</th>
|
||||
<th>Attempts</th>
|
||||
<th>Failed at</th>
|
||||
<th style={{ textAlign: 'right' }}>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{overview.dead_letters.map((dl) => (
|
||||
<tr key={dl.msg_id}>
|
||||
<td>
|
||||
<div className="cell-person">
|
||||
<div>
|
||||
<div className="n">{dl.full_name ?? '—'}</div>
|
||||
<div className="e">{dl.email ?? ''}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>{dl.event_name ?? '—'}</td>
|
||||
<td className="small">{dl.error ?? '—'}</td>
|
||||
<td>{dl.attempts ?? '—'}</td>
|
||||
<td className="muted small">{fmtTime(dl.failed_at)}</td>
|
||||
<td style={{ textAlign: 'right' }}>
|
||||
<div className="row" style={{ gap: 8, justifyContent: 'flex-end' }}>
|
||||
<button className="btn small" disabled={busyId === dl.msg_id} onClick={() => requeue(dl)}>
|
||||
Requeue
|
||||
</button>
|
||||
<button className="btn danger small" disabled={busyId === dl.msg_id} onClick={() => discard(dl)}>
|
||||
Discard
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{overview.dead_letters.length === 0 && (
|
||||
<div style={{ padding: 16 }}><Empty icon="✅" text="No failed jobs — everything printed or is still queued." /></div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="section-head"><h2 className="h2">Recently printed</h2></div>
|
||||
<div className="table-wrap">
|
||||
<table className="data">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attendee</th>
|
||||
<th>Kind</th>
|
||||
<th>Time</th>
|
||||
<th style={{ textAlign: 'right' }}>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{overview.recent.map((job) => (
|
||||
<tr key={job.msg_id}>
|
||||
<td>
|
||||
<div className="cell-person">
|
||||
<div>
|
||||
<div className="n">{job.full_name ?? '—'}</div>
|
||||
<div className="e">{job.email ?? ''}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><span className="pill">{kindLabel(job.kind)}</span></td>
|
||||
<td className="muted small">{fmtTime(job.archived_at)}</td>
|
||||
<td style={{ textAlign: 'right' }}>
|
||||
<button className="btn small" disabled={busyId === job.msg_id || !job.registration_id} onClick={() => reprint(job)}>
|
||||
Reprint
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{overview.recent.length === 0 && (
|
||||
<div style={{ padding: 16 }}><Empty icon="🖨️" text="Nothing has been printed yet." /></div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{issuedToken && (
|
||||
<Modal
|
||||
open
|
||||
title={`Station token — ${issuedToken.name}`}
|
||||
onClose={() => { setIssuedToken(null); setCopied(false); }}
|
||||
footer={
|
||||
<button className="btn primary" onClick={() => { setIssuedToken(null); setCopied(false); }}>
|
||||
Done
|
||||
</button>
|
||||
}
|
||||
>
|
||||
<p className="feedback-error" style={{ fontWeight: 700 }}>
|
||||
Store it in the Raspberry Pi setup now — it cannot be shown again.
|
||||
</p>
|
||||
<div className="row" style={{ gap: 8 }}>
|
||||
<input className="input mono" readOnly value={issuedToken.token} onFocus={(e) => e.target.select()} aria-label="Station token" />
|
||||
<button className="btn" onClick={copyToken}>{copied ? 'Copied' : 'Copy'}</button>
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -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<Registration | null>(null);
|
||||
const [badgeFor, setBadgeFor] = useState<Registration | null>(null);
|
||||
const [badgeLayouts, setBadgeLayouts] = useState<BadgeLayout[]>([]);
|
||||
const [printingIds, setPrintingIds] = useState<Set<string>>(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<string[]>([]);
|
||||
const [fTicket, setFTicket] = useState<string[]>([]);
|
||||
const [fCheckedIn, setFCheckedIn] = useState<string[]>([]);
|
||||
@@ -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 <Empty icon="⚠️" text={error} />;
|
||||
if (!loaded)
|
||||
return (
|
||||
@@ -327,6 +352,17 @@ export function Registrations() {
|
||||
</button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{badgeConfigured ? (
|
||||
<button className="btn small" disabled={printingIds.has(r.id)} onClick={() => printBadge(r)} title="Send this attendee's badge to the printer">
|
||||
{printingIds.has(r.id) ? 'Printing…' : 'Print'}
|
||||
</button>
|
||||
) : (
|
||||
<Tooltip title="No badge yet" content="A badge needs to be configured for this event first. Design one in the Badges view.">
|
||||
<button className="btn small" disabled>
|
||||
Print
|
||||
</button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!r.qr_token?.trim() && r.import_source === 'sessionize' && (
|
||||
<button className="btn small" disabled={busy} onClick={() => setMergeFor(r)}>
|
||||
Merge tickets
|
||||
|
||||
Reference in new issue
Block a user