From 44c65a706cddd535b4927a13fe6d40cd544fc394 Mon Sep 17 00:00:00 2001 From: Ivo Zeitz Date: Thu, 5 Nov 2026 12:51:24 +0100 Subject: [PATCH 1/7] feat(organizer): print a seller's item list and settlement The team prints both from the seller's details, above all for sellers without an account: name, category, details, price and state of each item, and the settlement with the same amounts as on screen. Offline messages now point to "Abrechnung" instead of the old name "Kassensturz". Closes #239 Closes #240 Co-Authored-By: Claude Opus 5.5 --- src/lib/sellerPrintout.test.ts | 117 ++++++++++ src/lib/sellerPrintout.ts | 214 ++++++++++++++++++ src/locales/de/organizer.json | 33 ++- src/locales/en/organizer.json | 33 ++- .../dashboard/ProductManagementPage.tsx | 35 +++ 5 files changed, 424 insertions(+), 8 deletions(-) create mode 100644 src/lib/sellerPrintout.test.ts create mode 100644 src/lib/sellerPrintout.ts diff --git a/src/lib/sellerPrintout.test.ts b/src/lib/sellerPrintout.test.ts new file mode 100644 index 00000000..09a55987 --- /dev/null +++ b/src/lib/sellerPrintout.test.ts @@ -0,0 +1,117 @@ +import { describe, expect, it, vi } from 'vitest'; +import { + buildSellerPrintoutPdf, + downloadSellerPrintout, + itemHeaders, + itemRows, + settlementRows, + settlementTotal, + type SellerPrintout, + type SellerPrintoutItem, +} from './sellerPrintout'; + +const save = vi.hoisted(() => vi.fn()); +vi.mock('jspdf', async (importOriginal) => { + const original = await importOriginal(); + class TestPdf extends original.jsPDF { + constructor(...args: ConstructorParameters) { + super(...args); + this.save = save; + } + } + return { ...original, jsPDF: TestPdf }; +}); + +const categories = [ + { _id: 'clothes', label: 'Kleidung' }, + { _id: 'other', label: 'Sonstiges' }, +]; +const item = (overrides: Partial = {}): SellerPrintoutItem => ({ + title: 'Winterjacke', + price: 12.5, + status: 'available', + productCategory: 'clothes', + ...overrides, +}); +const printout = (overrides: Partial = {}): SellerPrintout => ({ + event: { title: 'Kinderbasar', location: 'Ulm', startDate: 0, commission: 10 }, + seller: { + firstName: 'Anna', + lastName: 'Rad', + street: 'Münsterplatz 1', + zipCode: '89073', + city: 'Ulm', + sellerNumber: 7, + totalRevenue: 20, + commission: 2, + intakeFee: { perItem: 0.5, items: 3, total: 1.5 }, + payout: 16.5, + paid: false, + }, + items: [item(), item({ status: 'sold', sale: { totalAmount: 20 } })], + categories, + ...overrides, +}); + +describe('seller printouts', () => { + it('lists name, category, details, price and state of each item', () => { + expect(itemHeaders()).toEqual(['Artikel', 'Kategorie', 'Angaben', 'Preis (€)', 'Status']); + const rows = itemRows( + [ + item(), + item({ status: 'sold', sale: { totalAmount: 10 } }), + item({ status: 'sold' }), + item({ status: 'announced', productCategory: 'unknown' }), + item({ status: 'returned' }), + ], + categories + ); + expect(rows[0]).toEqual(['Winterjacke', 'Kleidung', '–', '12,50', 'Nicht verkauft']); + expect(rows[1][4]).toBe('Verkauft für 10,00 €'); + expect(rows[2][4]).toBe('Verkauft'); + expect(rows[3].slice(1, 2)).toEqual(['–']); + expect(rows[3][4]).toBe('Nicht abgegeben'); + expect(rows[4][4]).toBe('Zurückgegeben'); + }); + + it('shows the same settlement as the screen', () => { + expect(settlementRows(printout())).toEqual([ + ['Verkauft (1 Artikel)', '20,00 €'], + ['Provision (10 %)', '-2,00 €'], + ['Annahmegebühr (3 × 0,50 €)', '-1,50 €'], + ]); + expect(settlementTotal(printout())).toEqual(['Auszahlung', '16,50 €']); + }); + + it('leaves out an intake fee of nothing', () => { + const base = printout(); + const rows = settlementRows({ + ...base, + seller: { ...base.seller, intakeFee: { perItem: 0, items: 0, total: 0 } }, + }); + expect(rows).toHaveLength(2); + }); + + it('names the seller when they owe the bazaar', () => { + const base = printout(); + const total = settlementTotal({ ...base, seller: { ...base.seller, payout: -3 } }); + expect(total).toEqual(['Anna Rad zahlt', '3,00 €']); + }); + + it('builds both PDFs, and the list grows to more pages', () => { + const many = printout({ items: Array.from({ length: 120 }, () => item()) }); + expect(buildSellerPrintoutPdf('items', many).getNumberOfPages()).toBeGreaterThan(1); + const settlement = buildSellerPrintoutPdf('settlement', printout()); + const content = settlement.output(); + expect(content).toContain('Abrechnung: Kinderbasar'); + expect(content).toContain('Auszahlung'); + expect(content).toContain('Winterjacke'); + expect(content).toContain('Noch nicht abgerechnet'); + expect(buildSellerPrintoutPdf('items', printout()).output()).not.toContain('Auszahlung'); + }); + + it('saves the file under the name of the seller', async () => { + await downloadSellerPrintout('items', printout()); + expect(save).toHaveBeenCalledWith('Artikelliste-Anna-Rad.pdf'); + }); +}); diff --git a/src/lib/sellerPrintout.ts b/src/lib/sellerPrintout.ts new file mode 100644 index 00000000..9a7a4429 --- /dev/null +++ b/src/lib/sellerPrintout.ts @@ -0,0 +1,214 @@ +import { jsPDF } from 'jspdf'; +import type { CategoryTranslations, VendorWithCalculations } from './api/types'; +import { formatPriceDE } from './utils'; +import { categoryFieldText } from '../i18n/categoryFields'; +import { categoryName } from '../i18n/categories'; +import i18n from '../i18n'; +import { dateLocale } from '../i18n/format'; +import { savePdf } from './saveFile'; +import { drawTable, fileSlug } from './pdfTable'; +import { sellerAddress, sellerName } from './proofOfOffersPdf'; +import { describeAttributes, getCategoryFields } from '../shared/categoryFields'; + +/** + * Printouts for one seller, above all for those without an account (#239, #240): the list + * of their items, and the settlement with the same list to hand over at the payout. + */ + +export type SellerPrintoutKind = 'items' | 'settlement'; + +export interface SellerPrintoutItem { + title: string; + price: number; + status: 'announced' | 'available' | 'sold' | 'returned'; + productCategory: string; + attributes?: Record; + sale?: { totalAmount: number }; +} + +export interface SellerPrintoutCategory { + _id: string; + label: string; + parentCategory?: string; + translations?: CategoryTranslations; +} + +export interface SellerPrintout { + event: { title: string; location: string; startDate: number; commission: number }; + seller: Pick< + VendorWithCalculations, + | 'name' + | 'firstName' + | 'lastName' + | 'street' + | 'zipCode' + | 'city' + | 'country' + | 'sellerNumber' + | 'totalRevenue' + | 'commission' + | 'intakeFee' + | 'payout' + | 'paid' + >; + items: SellerPrintoutItem[]; + categories?: SellerPrintoutCategory[]; +} + +const MARGIN = 10; +/** Column widths in mm on A4 portrait (210 mm minus margins). */ +const ITEM_COLUMNS = [58, 32, 44, 18, 38]; +const SUMMARY_COLUMNS = [150, 40]; + +function text(key: string, values?: Record): string { + return i18n.t(`printout.${key}` as never, { ns: 'organizer', ...values }) as string; +} + +function settleText(key: string, values?: Record): string { + return i18n.t(`settle.${key}` as never, { ns: 'organizer', ...values }) as string; +} + +function formatDate(timestamp: number, withTime = false): string { + return new Date(timestamp).toLocaleString(dateLocale(), { + dateStyle: 'medium', + ...(withTime ? { timeStyle: 'short' } : {}), + }); +} + +function displayName(seller: SellerPrintout['seller']): string { + const fromParts = sellerName(seller); + return fromParts !== '–' ? fromParts : (seller.name ?? fromParts); +} + +function statusText(item: SellerPrintoutItem): string { + if (item.status !== 'sold') return text(`status.${item.status}`); + return item.sale + ? text('status.soldFor', { price: formatPriceDE(item.sale.totalAmount) }) + : text('status.sold'); +} + +export function itemHeaders(): string[] { + return [text('item'), text('category'), text('details'), text('price'), text('state')]; +} + +export function itemRows( + items: SellerPrintoutItem[], + categories: SellerPrintoutCategory[] = [] +): string[][] { + const byId = new Map(categories.map((category) => [category._id, category])); + return items.map((item) => { + const category = byId.get(item.productCategory); + const fields = getCategoryFields(item.productCategory, categories); + const details = describeAttributes(fields, item.attributes) + .map( + (attribute) => + `${categoryFieldText(attribute, 'label') ?? attribute.label}: ${attribute.value}` + ) + .join(' · '); + return [ + item.title, + category ? categoryName(category) : '–', + details || '–', + formatPriceDE(item.price), + statusText(item), + ]; + }); +} + +/** The same lines as on the settlement screen, without the final amount. */ +export function settlementRows({ event, seller, items }: SellerPrintout): string[][] { + const rows = [ + [ + settleText('sold', { count: items.filter((item) => item.status === 'sold').length }), + `${formatPriceDE(seller.totalRevenue)} €`, + ], + [ + settleText('commission', { percent: event.commission }), + `${seller.commission > 0 ? '-' : ''}${formatPriceDE(seller.commission)} €`, + ], + ]; + if (seller.intakeFee.total > 0) { + rows.push([ + settleText('intakeFee', { + items: seller.intakeFee.items, + perItem: formatPriceDE(seller.intakeFee.perItem), + }), + `-${formatPriceDE(seller.intakeFee.total)} €`, + ]); + } + return rows; +} + +/** With an intake fee and few sales the seller pays the bazaar instead. */ +export function settlementTotal({ seller }: SellerPrintout): string[] { + const owes = seller.payout < -0.005; + return [ + owes ? settleText('pays', { name: displayName(seller) }) : settleText('payout'), + `${formatPriceDE(Math.abs(seller.payout))} €`, + ]; +} + +export function buildSellerPrintoutPdf(kind: SellerPrintoutKind, printout: SellerPrintout): jsPDF { + const doc = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); + const { event, seller, items, categories } = printout; + const width = SUMMARY_COLUMNS[0] + SUMMARY_COLUMNS[1]; + + // Long titles and addresses wrap, what follows moves down with them + let y = 14; + const headerLine = (line: string, size: number, bold: boolean, gap: number) => { + doc.setFont('helvetica', bold ? 'bold' : 'normal'); + doc.setFontSize(size); + const lines = doc.splitTextToSize(line, width) as string[]; + doc.text(lines, MARGIN, y); + y += (lines.length - 1) * size * 0.45 + gap; + }; + headerLine(text(`${kind}Title`, { event: event.title }), 14, true, 6); + headerLine( + text('subtitle', { + location: event.location, + date: formatDate(event.startDate), + created: formatDate(Date.now(), true), + }), + 9, + false, + 8 + ); + const number = seller.sellerNumber !== undefined ? `${seller.sellerNumber} · ` : ''; + headerLine(`${number}${displayName(seller)}`, 11, true, 5); + headerLine(sellerAddress(seller), 9, false, 5); + + doc.setFontSize(8); + if (kind === 'settlement') { + y = drawTable(doc, { + columns: SUMMARY_COLUMNS, + headers: [text('settlement'), text('amount')], + rows: settlementRows(printout), + y, + margin: MARGIN, + }); + const [label, amount] = settlementTotal(printout); + doc.setFont('helvetica', 'bold'); + doc.setFontSize(11); + doc.text(label, MARGIN + 1, y + 6); + doc.text(amount, MARGIN + SUMMARY_COLUMNS[0] + 1, y + 6); + doc.setFont('helvetica', 'normal'); + doc.setFontSize(9); + doc.text(seller.paid ? text('settled') : text('notSettled'), MARGIN + 1, y + 11); + y += 16; + doc.setFontSize(8); + } + + drawTable(doc, { + columns: ITEM_COLUMNS, + headers: itemHeaders(), + rows: itemRows(items, categories), + y, + margin: MARGIN, + }); + return doc; +} + +export function downloadSellerPrintout(kind: SellerPrintoutKind, printout: SellerPrintout) { + const name = fileSlug(text(`${kind}FileName`), displayName(printout.seller)); + return savePdf(buildSellerPrintoutPdf(kind, printout), `${name}.pdf`); +} diff --git a/src/locales/de/organizer.json b/src/locales/de/organizer.json index 3ad9970b..5f665d6c 100644 --- a/src/locales/de/organizer.json +++ b/src/locales/de/organizer.json @@ -419,6 +419,8 @@ "showContact": "Kontaktdaten anzeigen", "addItem": "Artikel erfassen", "labelsPdf": "Etiketten (PDF)", + "printItems": "Artikelliste drucken", + "printSettlement": "Abrechnung drucken", "settledBadge": "Abgerechnet", "contact": "Kontakt", "address": "Adresse", @@ -437,8 +439,8 @@ "pending_other": "{{count}} Offline-Aktionen warten aufs Nachholen.", "replayed_one": "{{count}} Offline-Aktion nachgeholt", "replayed_other": "{{count}} Offline-Aktionen nachgeholt", - "refused_one": "{{count}} Offline-Aktion wurde abgelehnt – siehe Kassensturz.", - "refused_other": "{{count}} Offline-Aktionen wurden abgelehnt – siehe Kassensturz." + "refused_one": "{{count}} Offline-Aktion wurde abgelehnt – siehe Abrechnung.", + "refused_other": "{{count}} Offline-Aktionen wurden abgelehnt – siehe Abrechnung." } }, "list": { @@ -653,8 +655,8 @@ "queued_other": "{{count}} Artikel verkauft für {{total}} € – offline gespeichert, wird nachgebucht.", "synced_one": "{{count}} Offline-Verkauf nachgebucht", "synced_other": "{{count}} Offline-Verkäufe nachgebucht", - "conflicts_one": "{{count}} Artikel konnte nicht gebucht werden – siehe Kassensturz.", - "conflicts_other": "{{count}} Artikel konnten nicht gebucht werden – siehe Kassensturz." + "conflicts_one": "{{count}} Artikel konnte nicht gebucht werden – siehe Abrechnung.", + "conflicts_other": "{{count}} Artikel konnten nicht gebucht werden – siehe Abrechnung." }, "received": "{{total}} € erhalten", "cameraOn": "Kamera einschalten", @@ -682,6 +684,29 @@ "empty": "Für diesen Basar sind keine Artikel angemeldet.", "fileName": "Nachweis" }, + "printout": { + "itemsTitle": "Artikelliste: {{event}}", + "settlementTitle": "Abrechnung: {{event}}", + "subtitle": "{{location}}, {{date}} · erstellt am {{created}}", + "item": "Artikel", + "category": "Kategorie", + "details": "Angaben", + "price": "Preis (€)", + "state": "Status", + "settlement": "Abrechnung", + "amount": "Betrag", + "settled": "Abgerechnet", + "notSettled": "Noch nicht abgerechnet", + "status": { + "announced": "Nicht abgegeben", + "available": "Nicht verkauft", + "sold": "Verkauft", + "soldFor": "Verkauft für {{price}} €", + "returned": "Zurückgegeben" + }, + "itemsFileName": "Artikelliste", + "settlementFileName": "Abrechnung" + }, "export": { "cardTitle": "Abrechnung exportieren", "cardText": "Als Veranstalter musst du die Abrechnung aufbewahren (§ 147 AO). BazarPro löscht sie 8 Jahre nach Ende des Jahres, in dem der Basar war. Exportiere sie und lege sie zu deinen Unterlagen. Die Datei enthält Namen und Anschriften der Verkäufer: Bewahre sie sicher auf.", diff --git a/src/locales/en/organizer.json b/src/locales/en/organizer.json index ad641ebd..bd8210df 100644 --- a/src/locales/en/organizer.json +++ b/src/locales/en/organizer.json @@ -419,6 +419,8 @@ "showContact": "Show contact details", "addItem": "Add item", "labelsPdf": "Labels (PDF)", + "printItems": "Print item list", + "printSettlement": "Print settlement", "settledBadge": "Settled", "contact": "Contact", "address": "Address", @@ -437,8 +439,8 @@ "pending_other": "{{count}} offline actions are waiting.", "replayed_one": "{{count}} offline action done", "replayed_other": "{{count}} offline actions done", - "refused_one": "{{count}} offline action was refused – see cash reconciliation.", - "refused_other": "{{count}} offline actions were refused – see cash reconciliation." + "refused_one": "{{count}} offline action was refused – see settlement.", + "refused_other": "{{count}} offline actions were refused – see settlement." } }, "list": { @@ -653,8 +655,8 @@ "queued_other": "{{count}} items sold for {{total}} € – stored offline, will be booked.", "synced_one": "{{count}} offline sale booked", "synced_other": "{{count}} offline sales booked", - "conflicts_one": "{{count}} item could not be booked – see cash reconciliation.", - "conflicts_other": "{{count}} items could not be booked – see cash reconciliation." + "conflicts_one": "{{count}} item could not be booked – see settlement.", + "conflicts_other": "{{count}} items could not be booked – see settlement." }, "received": "{{total}} € received", "cameraOn": "Turn camera on", @@ -682,6 +684,29 @@ "empty": "No items are registered for this bazaar.", "fileName": "Record" }, + "printout": { + "itemsTitle": "Item list: {{event}}", + "settlementTitle": "Settlement: {{event}}", + "subtitle": "{{location}}, {{date}} · created on {{created}}", + "item": "Item", + "category": "Category", + "details": "Details", + "price": "Price (€)", + "state": "Status", + "settlement": "Settlement", + "amount": "Amount", + "settled": "Settled", + "notSettled": "Not settled yet", + "status": { + "announced": "Not handed in", + "available": "Not sold", + "sold": "Sold", + "soldFor": "Sold for {{price}} €", + "returned": "Returned" + }, + "itemsFileName": "Item-list", + "settlementFileName": "Settlement" + }, "export": { "cardTitle": "Export settlement", "cardText": "As the organizer, you have to keep the settlement (§ 147 AO). BazarPro deletes it 8 years after the end of the year of the bazaar. Export it and file it with your records. The file contains the sellers' names and addresses: keep it safe.", diff --git a/src/pages/organizer/events/dashboard/ProductManagementPage.tsx b/src/pages/organizer/events/dashboard/ProductManagementPage.tsx index f2d20231..0129fc2e 100644 --- a/src/pages/organizer/events/dashboard/ProductManagementPage.tsx +++ b/src/pages/organizer/events/dashboard/ProductManagementPage.tsx @@ -53,6 +53,11 @@ import type { VendorWithCalculations } from '../../../../lib/api/types'; import { SellerNumberBadge } from '../../../../components/sellers/SellerNumberBadge'; import { SortMarkBadge } from '../../../../components/sellers/SortMarkBadge'; import { downloadBasketLabel } from '../../../../lib/sortSheetsPdf'; +import { + downloadSellerPrintout, + type SellerPrintoutItem, + type SellerPrintoutKind, +} from '../../../../lib/sellerPrintout'; import { SellerIdCheck } from '../../../../components/sellers/SellerIdCheck'; import { useAssignMissingSellerNumbers } from '../../../../hooks/useAssignMissingSellerNumbers'; import { matchingVendors, productMatcher } from '../../../../lib/productSearch'; @@ -121,6 +126,7 @@ export function ProductManagementPage() { canManage ? { eventId } : 'skip' ); const event = useQuery(api.events.getEvent, { id: eventId }); + const categories = useQuery(api.categories.getAllCategories); // The intake works offline from what is on the device useOfflinePreparation(eventId, event, canManage); @@ -321,6 +327,16 @@ export function ProductManagementPage() { ).catch((e: unknown) => toast.error(getUserFacingErrorMessage(e))); }; + const handlePrintSeller = (kind: SellerPrintoutKind) => { + if (!selectedVendor || !event) return; + void downloadSellerPrintout(kind, { + event, + seller: selectedVendor, + items: vendorProducts as SellerPrintoutItem[], + categories, + }).catch((e: unknown) => toast.error(getUserFacingErrorMessage(e))); + }; + const handleDownloadAllQRCodes = () => { if (!vendorProducts || vendorProducts.length === 0) { toast.error(t('products.noProducts')); @@ -583,6 +599,25 @@ export function ProductManagementPage() { {t('products.labelsPdf')} )} + + {sellerMode === 'payout' && ( + + )} {selectedVendor.paid && ( Date: Thu, 5 Nov 2026 12:51:25 +0100 Subject: [PATCH 2/7] docs(legal): name the sorting code and invitations in the privacy text The code links a seller's bazaars, and invitations store addresses of people who may never answer. Also in the template for self-hosted instances. Co-Authored-By: Claude Opus 5.5 --- src/content/legal/bazarpro/privacy.md | 6 +++++- src/content/legal/templates/privacy.md | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/content/legal/bazarpro/privacy.md b/src/content/legal/bazarpro/privacy.md index 88bb4242..75126795 100644 --- a/src/content/legal/bazarpro/privacy.md +++ b/src/content/legal/bazarpro/privacy.md @@ -1,4 +1,4 @@ -Stand: 23.10.2026 +Stand: 05.11.2026 ## 1. Verantwortlicher @@ -78,9 +78,12 @@ Veranstalter legen für jede Veranstaltung fest, welche Funktionen zur Verfügun - Einen Mindestpreis sehen nur Sie und das Veranstalter-Team, nicht die Käufer. - Das Veranstalter-Team sieht die Kontaktdaten der teilnehmenden Verkäufer (Name, E-Mail-Adresse, Telefonnummer), um die Veranstaltung durchzuführen und abzurechnen. Es kann interne Notizen zu Artikeln anlegen, die nur das Team sieht. - Veranstalter können vor Ort Verkäufer ohne eigenes Konto anlegen und dafür Name, Telefonnummer und optional eine E-Mail-Adresse erfassen. Der Veranstalter informiert diese Personen über die Verarbeitung. +- Verkäufer bekommen mit dem ersten Artikel oder der ersten Teilnahme an einem Basar einen dauerhaften Sortiercode. Er bleibt bei allen Basaren derselbe, damit Etiketten wiederverwendet werden können. Bei Basaren mit Universal-Etiketten sehen ihn das Team dieses Basars und alle, die ein gedrucktes Etikett sehen. Der Code enthält keinen Namen, verbindet aber Ihre Teilnahmen: Wer ihn bei mehreren Basaren sieht, kann erkennen, dass es dieselbe Person ist. Er wird nicht an andere vergeben, auch nicht nach Löschung eines Kontos. Rechtsgrundlage ist die Durchführung des Nutzungsvertrags und der Teilnahme an der Veranstaltung (Art. 6 Abs. 1 lit. b DSGVO). +Veranstalter können Personen per E-Mail als Verkäufer oder Helfer zu ihrem Basar einladen. Dafür verarbeiten wir die angegebene E-Mail-Adresse, die vorgesehene Rolle, den Zeitpunkt und wer eingeladen hat. Die Adresse nutzen wir nur, um die Einladung zu senden und ihre Annahme zu prüfen. Die E-Mail nennt, wer eingeladen hat und dass der Veranstalter die Adresse angegeben hat; wer nicht teilnehmen möchte, muss nichts tun. Rechtsgrundlage ist Art. 6 Abs. 1 lit. f DSGVO; das berechtigte Interesse liegt darin, Verkäufer und Helfer für einen Basar zu gewinnen. + ## 10. Meldungen und Moderation Jede Person kann Inhalte melden, die sie für rechtswidrig oder regelwidrig hält. Wir verarbeiten dabei den gemeldeten Inhalt, den Grund, Ihre Beschreibung sowie Ihr Nutzerkonto oder, ohne Konto, Ihre E-Mail-Adresse, um Sie über unsere Entscheidung zu informieren. @@ -136,6 +139,7 @@ Ein automatischer Löschlauf prüft täglich diese Fristen: | Verkäufe und die Angaben der Verkäufer für die Abrechnung (Name, Anschrift, Kontaktdaten, Verkäufernummer) | 8 Jahre nach Ende des Jahres, in dem der Basar stattfand (Aufbewahrungspflicht des Veranstalters, § 147 AO); dann wird der Basar vollständig gelöscht | | Basare mit festem Nachweis, wer was angeboten hat (z. B. Fahrradbörsen) | Anschrift und Kontaktdaten 3 Jahre nach Ende des Jahres des Basars (Verjährung, § 195 BGB), danach bleiben nur Name und Verkäufernummer | | Vor Ort angelegte Verkäufer ohne Konto: E-Mail-Adresse und Telefonnummer | 3 Monate nach ihrem letzten Basar | +| Einladungen per E-Mail mit der angegebenen Adresse | 2 Tage nachdem sie angenommen, zurückgenommen oder ersetzt wurden, spätestens zum Ende des Basars | | Was das Team eines Basars ohne Internet erledigt hat (z. B. Annahme, interne Notiz) | 3 Monate nach dem Basar | | Nachrichten über das Kontaktformular | 6 Monate nach der Bearbeitung, unbearbeitet doppelt so lange | | Meldungen: E-Mail-Adresse, Konto und Angaben der meldenden Person | 6 Monate nach Erledigung | diff --git a/src/content/legal/templates/privacy.md b/src/content/legal/templates/privacy.md index ec97f430..ae8e5e02 100644 --- a/src/content/legal/templates/privacy.md +++ b/src/content/legal/templates/privacy.md @@ -78,9 +78,12 @@ Veranstalter legen für jede Veranstaltung fest, welche Funktionen zur Verfügun - Einen Mindestpreis sehen nur Sie und das Veranstalter-Team, nicht die Käufer. - Das Veranstalter-Team sieht die Kontaktdaten der teilnehmenden Verkäufer (Name, E-Mail-Adresse, Telefonnummer), um die Veranstaltung durchzuführen und abzurechnen. Es kann interne Notizen zu Artikeln anlegen, die nur das Team sieht. - Veranstalter können vor Ort Verkäufer ohne eigenes Konto anlegen und dafür Name, Telefonnummer und optional eine E-Mail-Adresse erfassen. Der Veranstalter informiert diese Personen über die Verarbeitung. +- Verkäufer bekommen mit dem ersten Artikel oder der ersten Teilnahme an einem Basar einen dauerhaften Sortiercode. Er bleibt bei allen Basaren derselbe, damit Etiketten wiederverwendet werden können. Bei Basaren mit Universal-Etiketten sehen ihn das Team dieses Basars und alle, die ein gedrucktes Etikett sehen. Der Code enthält keinen Namen, verbindet aber Ihre Teilnahmen: Wer ihn bei mehreren Basaren sieht, kann erkennen, dass es dieselbe Person ist. Er wird nicht an andere vergeben, auch nicht nach Löschung eines Kontos. Rechtsgrundlage ist die Durchführung des Nutzungsvertrags und der Teilnahme an der Veranstaltung (Art. 6 Abs. 1 lit. b DSGVO). +Veranstalter können Personen per E-Mail als Verkäufer oder Helfer zu ihrem Basar einladen. Dafür verarbeiten wir die angegebene E-Mail-Adresse, die vorgesehene Rolle, den Zeitpunkt und wer eingeladen hat. Die Adresse nutzen wir nur, um die Einladung zu senden und ihre Annahme zu prüfen. Die E-Mail nennt, wer eingeladen hat und dass der Veranstalter die Adresse angegeben hat; wer nicht teilnehmen möchte, muss nichts tun. Rechtsgrundlage ist Art. 6 Abs. 1 lit. f DSGVO; das berechtigte Interesse liegt darin, Verkäufer und Helfer für einen Basar zu gewinnen. + ## Meldungen und Moderation Jede Person kann Inhalte melden, die sie für rechtswidrig oder regelwidrig hält. Wir verarbeiten dabei den gemeldeten Inhalt, den Grund, Ihre Beschreibung sowie Ihr Nutzerkonto oder, ohne Konto, Ihre E-Mail-Adresse, um Sie über unsere Entscheidung zu informieren. @@ -117,6 +120,7 @@ Ein automatischer Löschlauf prüft täglich diese Fristen: | Verkäufe und die Angaben der Verkäufer für die Abrechnung (Name, Anschrift, Kontaktdaten, Verkäufernummer) | [[8 Jahre, siehe RETENTION_RECORDS_YEARS]] nach Ende des Jahres, in dem der Basar stattfand (Aufbewahrungspflicht des Veranstalters, § 147 AO); dann wird der Basar vollständig gelöscht | | Basare mit festem Nachweis, wer was angeboten hat (z. B. Fahrradbörsen) | Anschrift und Kontaktdaten [[3 Jahre, siehe RETENTION_SELLER_RECORD_YEARS]] nach Ende des Jahres des Basars (Verjährung, § 195 BGB), danach bleiben nur Name und Verkäufernummer | | Vor Ort angelegte Verkäufer ohne Konto: E-Mail-Adresse und Telefonnummer | [[3 Monate, siehe RETENTION_WALK_IN_CONTACT_DAYS]] nach ihrem letzten Basar | +| Einladungen per E-Mail mit der angegebenen Adresse | 2 Tage nachdem sie angenommen, zurückgenommen oder ersetzt wurden, spätestens zum Ende des Basars | | Was das Team eines Basars ohne Internet erledigt hat (z. B. Annahme, interne Notiz) | 3 Monate nach dem Basar | | Nachrichten über das Kontaktformular | [[6 Monate, siehe RETENTION_CONTACT_MESSAGE_DAYS]] nach der Bearbeitung, unbearbeitet doppelt so lange | | Meldungen: E-Mail-Adresse, Konto und Angaben der meldenden Person | [[6 Monate, siehe RETENTION_REPORT_DAYS]] nach Erledigung | From 8ac3e0399b17d026da0cd724b5042c5a22f7510c Mon Sep 17 00:00:00 2001 From: Ivo Zeitz Date: Thu, 5 Nov 2026 12:59:23 +0100 Subject: [PATCH 3/7] fix(organizer): no empty address line on seller printouts Sellers without an account often have no address. Co-Authored-By: Claude Opus 5.5 --- src/lib/sellerPrintout.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/sellerPrintout.ts b/src/lib/sellerPrintout.ts index 9a7a4429..ac7f56f3 100644 --- a/src/lib/sellerPrintout.ts +++ b/src/lib/sellerPrintout.ts @@ -175,7 +175,8 @@ export function buildSellerPrintoutPdf(kind: SellerPrintoutKind, printout: Selle ); const number = seller.sellerNumber !== undefined ? `${seller.sellerNumber} · ` : ''; headerLine(`${number}${displayName(seller)}`, 11, true, 5); - headerLine(sellerAddress(seller), 9, false, 5); + const address = sellerAddress(seller); + if (address !== '–') headerLine(address, 9, false, 5); doc.setFontSize(8); if (kind === 'settlement') { From 3dd68b3b4804a64aedb1b7392f7ae55b81d7de7b Mon Sep 17 00:00:00 2001 From: Ivo Zeitz Date: Thu, 5 Nov 2026 13:16:59 +0100 Subject: [PATCH 4/7] test(checkout): the offline message points to "Abrechnung" Co-Authored-By: Claude Opus 5.5 --- src/tests/auth/offline-checkout.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/auth/offline-checkout.spec.ts b/src/tests/auth/offline-checkout.spec.ts index 8f7162d4..384bf88a 100644 --- a/src/tests/auth/offline-checkout.spec.ts +++ b/src/tests/auth/offline-checkout.spec.ts @@ -51,7 +51,7 @@ test('two offline desks sell the same item: one is booked, the other is a confli await expect(page.getByText('1 Offline-Verkauf nachgebucht')).toBeVisible({ timeout: 30_000 }); await second.context().setOffline(false); await expect( - second.getByText('1 Artikel konnte nicht gebucht werden – siehe Kassensturz.') + second.getByText('1 Artikel konnte nicht gebucht werden – siehe Abrechnung.') ).toBeVisible({ timeout: 30_000 }); await page.goto(`/events/view/${showcase.eventId}/cash`); From 9b3d73565d5d9665ec51870372d2fc87218d8dce Mon Sep 17 00:00:00 2001 From: Ivo Zeitz Date: Thu, 5 Nov 2026 15:04:57 +0100 Subject: [PATCH 5/7] feat(auth): login and register fit a phone without scrolling The form takes the full width on a phone, without a card around it. One way back from "forgot password", which leads to the login form. The seller panel keeps its header the same in both tabs: all printouts in one menu, the tabs right below it. Adding an item belongs to the intake tab, which now says how many items there are. Co-Authored-By: Claude Opus 5.5 --- src/locales/de/organizer.json | 14 +- src/locales/en/organizer.json | 14 +- .../dashboard/ProductManagementPage.tsx | 168 ++++++------ src/pages/public/auth/LoginPage.test.tsx | 34 +++ src/pages/public/auth/LoginPage.tsx | 239 +++++++++-------- src/pages/public/auth/RegisterPage.tsx | 247 +++++++++--------- src/pages/public/auth/components/AuthPage.tsx | 49 ++++ .../auth/components/EmailVerificationForm.tsx | 14 +- .../auth/components/ForgotPasswordForm.tsx | 33 +-- .../public/auth/components/OAuthButtons.tsx | 12 +- 10 files changed, 446 insertions(+), 378 deletions(-) create mode 100644 src/pages/public/auth/LoginPage.test.tsx create mode 100644 src/pages/public/auth/components/AuthPage.tsx diff --git a/src/locales/de/organizer.json b/src/locales/de/organizer.json index 5f665d6c..d24104fe 100644 --- a/src/locales/de/organizer.json +++ b/src/locales/de/organizer.json @@ -319,7 +319,6 @@ "sortClash_one": "{{count}} Korb hat dasselbe Muster wie ein anderer und unterscheidet sich nur im Buchstaben.", "sortClash_other": "{{count}} Körbe haben dasselbe Muster wie ein anderer und unterscheiden sich nur im Buchstaben. Die Sortierblätter weisen darauf hin.", "sortClashNote": "Achtung: Ein anderer Korb hat dasselbe Muster. Achte auf den Buchstaben: Etiketten ohne Buchstabe gehören in den Korb ohne Buchstabe.", - "basketLabel": "Korb-Etikett drucken", "allLabels": "Alle Etiketten", "allLabelsHint": "Die Artikel-Etiketten aller Verkäufer dieses Basars als ein PDF, Verkäufer für Verkäufer", "add": "Hinzufügen", @@ -402,7 +401,6 @@ "allAccepted": "Alle Artikel als verfügbar markiert", "settled": "Abrechnung abgeschlossen", "unsettled": "Abrechnung zurückgenommen", - "noProducts": "Keine Artikel für diesen Teilnehmer gefunden", "labelsCreating": "Etiketten werden erstellt…", "labelsCreated": "{{count}} Etiketten erstellt", "labelsFailed": "Fehler beim Erstellen der Etiketten", @@ -418,9 +416,17 @@ "hideDetails": "Details verbergen", "showContact": "Kontaktdaten anzeigen", "addItem": "Artikel erfassen", + "print": "Drucken", "labelsPdf": "Etiketten (PDF)", - "printItems": "Artikelliste drucken", - "printSettlement": "Abrechnung drucken", + "printBasketLabel": "Korb-Etikett", + "printItems": "Artikelliste", + "printSettlement": "Abrechnung", + "itemCount_one": "{{count}} Artikel", + "itemCount_other": "{{count}} Artikel", + "countOpen": "{{count}} offen", + "countAccepted": "{{count}} angenommen", + "countSold": "{{count}} verkauft", + "countReturned": "{{count}} zurückgegeben", "settledBadge": "Abgerechnet", "contact": "Kontakt", "address": "Adresse", diff --git a/src/locales/en/organizer.json b/src/locales/en/organizer.json index bd8210df..ab08d457 100644 --- a/src/locales/en/organizer.json +++ b/src/locales/en/organizer.json @@ -319,7 +319,6 @@ "sortClash_one": "{{count}} basket has the same pattern as another one and differs by the letter only.", "sortClash_other": "{{count}} baskets have the same pattern as another one and differ by the letter only. The sorting sheets point this out.", "sortClashNote": "Note: another basket has the same pattern. Check the letter: labels without a letter belong in the basket without a letter.", - "basketLabel": "Print basket label", "allLabels": "All labels", "allLabelsHint": "The item labels of all sellers of this bazaar as one PDF, seller by seller", "add": "Add", @@ -402,7 +401,6 @@ "allAccepted": "All items marked as available", "settled": "Settlement finished", "unsettled": "Settlement undone", - "noProducts": "No items found for this participant", "labelsCreating": "Creating labels…", "labelsCreated": "{{count}} labels created", "labelsFailed": "Creating the labels failed", @@ -418,9 +416,17 @@ "hideDetails": "Hide details", "showContact": "Show contact details", "addItem": "Add item", + "print": "Print", "labelsPdf": "Labels (PDF)", - "printItems": "Print item list", - "printSettlement": "Print settlement", + "printBasketLabel": "Basket label", + "printItems": "Item list", + "printSettlement": "Settlement", + "itemCount_one": "{{count}} item", + "itemCount_other": "{{count}} items", + "countOpen": "{{count}} open", + "countAccepted": "{{count}} accepted", + "countSold": "{{count}} sold", + "countReturned": "{{count}} returned", "settledBadge": "Settled", "contact": "Contact", "address": "Address", diff --git a/src/pages/organizer/events/dashboard/ProductManagementPage.tsx b/src/pages/organizer/events/dashboard/ProductManagementPage.tsx index 0129fc2e..1273f381 100644 --- a/src/pages/organizer/events/dashboard/ProductManagementPage.tsx +++ b/src/pages/organizer/events/dashboard/ProductManagementPage.tsx @@ -31,7 +31,6 @@ import { Phone, CheckCircle2, DollarSign, - Download, Printer, ChevronDown, ChevronUp, @@ -41,6 +40,12 @@ import { import { Button } from '../../../../components/ui/button'; import { Badge } from '../../../../components/ui/badge'; import { Tabs, TabsList, TabsTrigger } from '../../../../components/ui/tabs'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '../../../../components/ui/dropdown-menu'; import { getUserFacingErrorMessage } from '../../../../lib/errors'; import { VendorSettlement } from './components/VendorSettlement'; import { SaleConflictsCard } from './components/SaleConflictsCard'; @@ -337,15 +342,6 @@ export function ProductManagementPage() { }).catch((e: unknown) => toast.error(getUserFacingErrorMessage(e))); }; - const handleDownloadAllQRCodes = () => { - if (!vendorProducts || vendorProducts.length === 0) { - toast.error(t('products.noProducts')); - return; - } - - setLabelsOpen(true); - }; - // Individual product action states const [returnDialogOpen, setReturnDialogOpen] = useState(false); const [confirmDialogOpen, setConfirmDialogOpen] = useState(false); @@ -566,58 +562,8 @@ export function ProductManagementPage() { -
- {selectedVendor.managedByEventId === eventId && !selectedVendor.paid && ( - - )} - {sellerMode === 'acceptance' && selectedVendor.sortCode !== undefined && ( -
- - -
- )} - {sellerMode === 'acceptance' && ( - - )} - - {sellerMode === 'payout' && ( - - )} + {/* The same in both tabs: switching them changes only what is below */} +
{selectedVendor.paid && ( {t('products.settledBadge')} )} + + + + + + setLabelsOpen(true)} + > + {t('products.labelsPdf')} + + {selectedVendor.sortCode !== undefined && ( + + {t('products.printBasketLabel')} + + )} + handlePrintSeller('items')} + > + {t('products.printItems')} + + handlePrintSeller('settlement')}> + {t('products.printSettlement')} + + +
- {/* Fixed seller data: compare with the ID card before the first intake */} - {sellerMode === 'acceptance' && selectedVendor.detailsRecorded === false && ( -
- -
- )} - {/* Collapsible Contact Info */} {isContactExpanded && (
@@ -711,15 +680,58 @@ export function ProductManagementPage() { {sellerMode === 'acceptance' && (
-
- + {/* Fixed seller data: compare with the ID card before the first intake */} + {selectedVendor.detailsRecorded === false && ( + + )} +
+
+ {selectedVendor.sortCode !== undefined && ( + + )} +
+

+ {t('products.itemCount', { count: vendorProducts.length })} +

+ {vendorProducts.length > 0 && ( +

+ {[ + [stats.announced, t('products.countOpen', { count: stats.announced })], + [ + stats.available, + t('products.countAccepted', { count: stats.available }), + ], + [stats.sold, t('products.countSold', { count: stats.sold })], + [ + stats.returned, + t('products.countReturned', { count: stats.returned }), + ], + ] + .filter(([count]) => count !== 0) + .map(([, label]) => label) + .join(' · ')} +

+ )} +
+
+
+ {selectedVendor.managedByEventId === eventId && !selectedVendor.paid && ( + + )} + +
)} diff --git a/src/pages/public/auth/LoginPage.test.tsx b/src/pages/public/auth/LoginPage.test.tsx new file mode 100644 index 00000000..2ea62bff --- /dev/null +++ b/src/pages/public/auth/LoginPage.test.tsx @@ -0,0 +1,34 @@ +import { fireEvent, render, screen } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; +import { describe, expect, it, vi } from 'vitest'; +import { getFunctionName } from '../../../lib/api/functions'; +import type { FunctionReference } from '../../../lib/api/types'; +import { LoginPage } from './LoginPage'; + +vi.mock('../../../lib/api/react', () => ({ + useAuthState: () => ({ isLoading: false, isAuthenticated: false }), + useAuthActions: () => ({ signIn: vi.fn() }), + useQuery: (ref: FunctionReference<'query'>) => + ({ 'featureFlags.get': {}, 'authProviders.configured': {} })[getFunctionName(ref)], +})); +vi.mock('../../../context/UserRoleContext', () => ({ useUserRole: () => ({ role: null }) })); +vi.mock('../../../hooks/useRedirectAfterLogin', () => ({ + useRedirectAfterLogin: () => false, + OVERVIEW_PATH: '/overview', +})); +vi.mock('../../../native/ServerSwitch', () => ({ ServerSwitch: () => null })); + +describe('LoginPage', () => { + it('has one way back from "forgot password", which leads to the login form', () => { + render( + + + + ); + fireEvent.click(screen.getByRole('button', { name: 'Passwort vergessen?' })); + expect(screen.getByRole('heading', { name: 'Passwort vergessen?' })).toBeInTheDocument(); + + fireEvent.click(screen.getByRole('button', { name: 'Zurück' })); + expect(screen.getByRole('heading', { name: 'Willkommen zurück' })).toBeInTheDocument(); + }); +}); diff --git a/src/pages/public/auth/LoginPage.tsx b/src/pages/public/auth/LoginPage.tsx index 6f61d562..be25209c 100644 --- a/src/pages/public/auth/LoginPage.tsx +++ b/src/pages/public/auth/LoginPage.tsx @@ -1,9 +1,8 @@ import { useAuthActions, useAuthState } from '../../../lib/api/react'; -import { BackButton } from '../../../components/navigation/BackButton'; import { Navigate, useLocation, useNavigate, useSearchParams } from 'react-router-dom'; import { useState } from 'react'; import { Alert, AlertDescription } from '../../../components/ui/alert'; -import { Label } from '@radix-ui/react-label'; +import { Label } from '../../../components/ui/label'; import { Input } from '../../../components/ui/input'; import { Button } from '../../../components/ui/button'; import { useFeatureFlags } from '../../../hooks/useFeatureFlags'; @@ -12,6 +11,7 @@ import { useEffect } from 'react'; import { EmailVerificationForm } from './components/EmailVerificationForm'; import { ForgotPasswordForm } from './components/ForgotPasswordForm'; import { OAuthButtons } from './components/OAuthButtons'; +import { AuthPage } from './components/AuthPage'; import { apiErrorCode } from '../../../lib/errors'; import { toast } from 'sonner'; import { safeRedirectPath } from '../../../lib/loginRedirect'; @@ -257,132 +257,131 @@ export function LoginPage() { return ; } + const leaveForgotPassword = () => { + setShowForgotPassword(false); + setError(''); + setInfo(''); + }; + return ( -
-
- -
-
- {!verificationEmail && !showForgotPassword && ( - <> -

{t('login.title')}

-

{t('login.subtitle')}

- - )} + } + {...(showForgotPassword ? { onBack: leaveForgotPassword } : {})} + > + {!verificationEmail && !showForgotPassword && ( + <> +

+ {t('login.title')} +

+

+ {t('login.subtitle')} +

+ + )} - {error && ( - - {error} - - )} + {error && ( + + {error} + + )} - {info && !verificationEmail && !showForgotPassword && ( - - {info} - - )} + {info && !verificationEmail && !showForgotPassword && ( + + {info} + + )} - {!isLoginEnabled && !verificationEmail && !showForgotPassword && ( - - {t('login.disabled')} - - )} + {!isLoginEnabled && !verificationEmail && !showForgotPassword && ( + + {t('login.disabled')} + + )} - {!verificationEmail && !showForgotPassword ? ( - <> - -
-
- - setEmail(e.target.value)} - placeholder={t('emailPlaceholder')} - required - disabled={!isLoginEnabled} - /> -
+ {!verificationEmail && !showForgotPassword ? ( + <> +
+ +
+ +
+ + setEmail(e.target.value)} + placeholder={t('emailPlaceholder')} + required + disabled={!isLoginEnabled} + /> +
-
-
- - -
- setPassword(e.target.value)} - required - disabled={!isLoginEnabled} - /> -
+
+
+ + +
+ setPassword(e.target.value)} + required + disabled={!isLoginEnabled} + /> +
- -
+ + -
- {t('login.noAccount')} - -
- - ) : verificationEmail ? ( - - ) : ( - { - setShowForgotPassword(false); - setError(''); - setInfo(''); - }} - /> - )} +
+ {t('login.noAccount')} +
- -
-
-
+ + ) : verificationEmail ? ( + + ) : ( + + )} + ); } diff --git a/src/pages/public/auth/RegisterPage.tsx b/src/pages/public/auth/RegisterPage.tsx index 87dfde32..ea479170 100644 --- a/src/pages/public/auth/RegisterPage.tsx +++ b/src/pages/public/auth/RegisterPage.tsx @@ -1,7 +1,6 @@ import { CREATE_DRAFT_PATH } from '../../../lib/eventDraft'; import { PasswordInput } from '../../../components/auth/PasswordInput'; import { MIN_PASSWORD_LENGTH } from '../../../shared/constants'; -import { BackButton } from '../../../components/navigation/BackButton'; import { Navigate, useNavigate } from 'react-router-dom'; import { Input } from '../../../components/ui/input'; import { Button } from '../../../components/ui/button'; @@ -17,6 +16,7 @@ import { AuthFormSkeleton } from '../../../components/ui/loading'; import { useEffect, useMemo, useState } from 'react'; import { EmailVerificationForm } from './components/EmailVerificationForm'; import { OAuthButtons } from './components/OAuthButtons'; +import { AuthPage } from './components/AuthPage'; import { toast } from 'sonner'; import { useLocation } from 'react-router-dom'; import { apiErrorCode, appErrorData, getUserFacingErrorMessage } from '../../../lib/errors'; @@ -253,142 +253,135 @@ export function RegisterPage() { } return ( -
-
- -
-
- {!verificationEmail ? ( -
-
-

{t('register.title')}

-

{t('register.subtitle')}

-
+ + {!verificationEmail ? ( +
+
+

{t('register.title')}

+

{t('register.subtitle')}

+
- {!isRegistrationEnabled && ( - - {t('register.disabled')} - - )} - {error && ( - - {error} - - )} + {!isRegistrationEnabled && ( + + {t('register.disabled')} + + )} + {error && ( + + {error} + + )} - {info && ( - - {info} - - )} + {info && ( + + {info} + + )} - + -
-
- - - {errors.email && ( -

- {errors.email.message} -

- )} -
+ +
+ + + {errors.email && ( +

+ {errors.email.message} +

+ )} +
-
- - -

- {errors.password?.message ?? t('register.passwordHint')} -

-
+
+ + +

+ {errors.password?.message ?? t('register.passwordHint')} +

+
- + -

- - ), - privacy: ( - - ), - }} +

+ -

- - -
- {t('register.haveAccount')} - -
-
- ) : ( - + ), + }} /> - )} +

+ + +
+ {t('register.haveAccount')} +
-
-
+ ) : ( + + )} + ); } diff --git a/src/pages/public/auth/components/AuthPage.tsx b/src/pages/public/auth/components/AuthPage.tsx new file mode 100644 index 00000000..08b4c008 --- /dev/null +++ b/src/pages/public/auth/components/AuthPage.tsx @@ -0,0 +1,49 @@ +import type { ReactNode } from 'react'; +import { BackButton } from '../../../../components/navigation/BackButton'; +import { cn } from '../../../../lib/utils'; + +/** "or" between two lines. Without a background of its own: the form has none on a phone */ +export function AuthDivider({ children, className }: { children: ReactNode; className?: string }) { + return ( +
+ + {children} + +
+ ); +} + +/** + * The frame of the login and register pages. On a phone the form takes the full width + * and fits the screen without a card around it; from `sm` on it sits in a card. + */ +export function AuthPage({ + children, + below, + onBack, + testId, +}: { + children: ReactNode; + /** Outside the card, below the form */ + below?: ReactNode; + /** Replaces the way back to the previous page, for a step inside the form */ + onBack?: () => void; + testId?: string; +}) { + return ( + // The negative margins give back most of the padding of the page layout on a phone +
+ +
+
{children}
+ {below} +
+
+ ); +} diff --git a/src/pages/public/auth/components/EmailVerificationForm.tsx b/src/pages/public/auth/components/EmailVerificationForm.tsx index cb57650a..cdd00354 100644 --- a/src/pages/public/auth/components/EmailVerificationForm.tsx +++ b/src/pages/public/auth/components/EmailVerificationForm.tsx @@ -4,6 +4,7 @@ import { Label } from '../../../../components/ui/label'; import { Mail, ArrowRight, RefreshCw, CheckCircle2 } from 'lucide-react'; import { Alert, AlertDescription } from '../../../../components/ui/alert'; import { Trans, useTranslation } from 'react-i18next'; +import { AuthDivider } from './AuthPage'; interface EmailVerificationFormProps { email: string; @@ -47,8 +48,8 @@ export function EmailVerificationForm({ )}
-
- +
+

{t('verify.title')}

@@ -101,14 +102,7 @@ export function EmailVerificationForm({ )} -

-
- -
-
- {t('or')} -
-
+ {t('or')} )} - -
-
- -
-
- {t('or')} -
-
- -
- -
); } diff --git a/src/pages/public/auth/components/OAuthButtons.tsx b/src/pages/public/auth/components/OAuthButtons.tsx index f9cb3654..a08a9f5a 100644 --- a/src/pages/public/auth/components/OAuthButtons.tsx +++ b/src/pages/public/auth/components/OAuthButtons.tsx @@ -2,6 +2,7 @@ import { useTranslation } from 'react-i18next'; import { Button } from '../../../../components/ui/button'; import { api } from '../../../../lib/api/functions'; import { useAuthActions, useQuery } from '../../../../lib/api/react'; +import { AuthDivider } from './AuthPage'; /** * Sign-in with Google and GitHub, on the login and the register page alike: one click @@ -26,7 +27,7 @@ export function OAuthButtons({ : '/login?oauth=1'; return ( -
+
{providers.google && (