Fixes & Refinements: QR token on registration, role caps, connection detail + red dot, admin schedule/sponsors
Datamodel: - Move qr_token from contacts to registrations (per event); new migration 20260826000000. lanyard_lookup / create_connection_request / checkin_attendee resolve via registrations + active event. - reset_qr_token -> reset_registration_qr_token (fixes ambiguous 'email' col). - upsert_contact drops the token arg; create_registration generates + syncs it. - Pretix sync writes the token to the registration (keeps it on re-sync). Registration types: - Distinct pill colors; red reserved for Staff (both apps). - Roles capitalized everywhere (Attendee/Speaker/Sponsor/Staff); 'Attendee' hidden only at the Home footer. - Reset-token button moved from Contacts to Registrations (per registration). Sessions (APPE Admin): - Slot types capitalized; material submitted/not-submitted state. - Speaker selection = multi-select search dropdown. - Fix 'a session must have a speaker' on edit (diff-based setSessionSpeakers) and the file-upload bug (speaker save no longer aborts first). APPE Admin: - Sponsors contact lookup = search field (filter + pick). Convivo App: - Other people's QR codes hidden; connection detail sheet shows public info + points. - Connect red dot recalculates immediately on accept/decline/send. - 'My picks today' = 2 rows (current + next); 'tap to change' links to Agenda. Docs updated across backend + frontend.
This commit is contained in:
1 parent
005f1d404f
commit
b52d8ab007
30 files changed
+1083
-232
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { adjustPoints, getAllContacts, resetQrToken, updateContact, upsertContact } from '../lib/api';
|
||||
import { adjustPoints, getAllContacts, updateContact, upsertContact } from '../lib/api';
|
||||
import type { Contact } from '../lib/types';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
import { Avatar, Empty, Modal, QrImage, Spinner, Toggle } from '../components/ui';
|
||||
import { Avatar, Empty, Modal, Spinner, Toggle } from '../components/ui';
|
||||
|
||||
export function Contacts() {
|
||||
const { push } = useToast();
|
||||
@@ -12,10 +12,7 @@ export function Contacts() {
|
||||
|
||||
const [editing, setEditing] = useState<Contact | null>(null);
|
||||
const [creating, setCreating] = useState(false);
|
||||
const [qrFor, setQrFor] = useState<Contact | null>(null);
|
||||
const [newToken, setNewToken] = useState<string | null>(null);
|
||||
const [pointsFor, setPointsFor] = useState<Contact | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
@@ -37,26 +34,10 @@ export function Contacts() {
|
||||
(c) =>
|
||||
c.full_name.toLowerCase().includes(q) ||
|
||||
c.email.toLowerCase().includes(q) ||
|
||||
(c.linkedin_url ?? '').toLowerCase().includes(q) ||
|
||||
(c.qr_token ?? '').toLowerCase().includes(q),
|
||||
(c.linkedin_url ?? '').toLowerCase().includes(q),
|
||||
);
|
||||
}, [contacts, query]);
|
||||
|
||||
async function doResetQr(c: Contact) {
|
||||
setBusy(true);
|
||||
try {
|
||||
const res = await resetQrToken(c.email);
|
||||
setNewToken(res.qr_token);
|
||||
setQrFor(c);
|
||||
await load();
|
||||
push('success', `New QR token issued for ${c.full_name}`);
|
||||
} catch (e) {
|
||||
push('error', e instanceof Error ? e.message : 'Reset failed');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (error) return <Empty icon="⚠️" text={error} />;
|
||||
if (!contacts)
|
||||
return (
|
||||
@@ -70,13 +51,13 @@ export function Contacts() {
|
||||
<div className="page-head">
|
||||
<div>
|
||||
<h1>Contacts</h1>
|
||||
<div className="sub">{contacts.length} people · manage contacts, QR tokens, and points.</div>
|
||||
<div className="sub">{contacts.length} people · manage contacts and points.</div>
|
||||
</div>
|
||||
<div className="row" style={{ gap: 10 }}>
|
||||
<input
|
||||
className="input"
|
||||
style={{ maxWidth: 260 }}
|
||||
placeholder="Search name, email, token…"
|
||||
placeholder="Search name, email…"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
/>
|
||||
@@ -94,7 +75,6 @@ export function Contacts() {
|
||||
<th>LinkedIn</th>
|
||||
<th>Visibility</th>
|
||||
<th>Admin</th>
|
||||
<th>QR token</th>
|
||||
<th style={{ textAlign: 'right' }}>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -132,17 +112,11 @@ export function Contacts() {
|
||||
<td>
|
||||
{c.is_admin ? <span className="pill admin">admin</span> : <span className="muted small">—</span>}
|
||||
</td>
|
||||
<td>
|
||||
<span className="mono small">{c.qr_token ?? '—'}</span>
|
||||
</td>
|
||||
<td>
|
||||
<div className="row-actions">
|
||||
<button className="btn small" onClick={() => setEditing(c)}>
|
||||
Edit
|
||||
</button>
|
||||
<button className="btn small" onClick={() => { setNewToken(null); setQrFor(c); }}>
|
||||
QR
|
||||
</button>
|
||||
<button className="btn small" onClick={() => setPointsFor(c)}>
|
||||
Points
|
||||
</button>
|
||||
@@ -178,42 +152,6 @@ export function Contacts() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{qrFor && (
|
||||
<Modal
|
||||
open
|
||||
title={`QR — ${qrFor.full_name}`}
|
||||
onClose={() => setQrFor(null)}
|
||||
footer={
|
||||
<>
|
||||
<button className="btn danger" disabled={busy} onClick={() => doResetQr(qrFor)}>
|
||||
{busy ? 'Resetting…' : 'Reset token'}
|
||||
</button>
|
||||
<button className="btn primary" onClick={() => setQrFor(null)}>
|
||||
Done
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="qr-wrap">
|
||||
{newToken ? (
|
||||
<>
|
||||
<QrImage value={newToken} size={190} />
|
||||
<div className="token-big">{newToken}</div>
|
||||
<p className="muted small">
|
||||
New token issued. The old token no longer works — the person must re-scan.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<QrImage value={qrFor.qr_token ?? ''} size={190} />
|
||||
<div className="token-big">{qrFor.qr_token ?? '—'}</div>
|
||||
<p className="muted small">Current token. Reset to issue a new one.</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{pointsFor && (
|
||||
<AdjustPointsModal
|
||||
contact={pointsFor}
|
||||
@@ -361,7 +299,7 @@ function CreateContactModal({
|
||||
<div className="row">
|
||||
<Toggle checked={isAdmin} onChange={setIsAdmin} label="Admin / staff" />
|
||||
</div>
|
||||
<p className="muted small">A QR token is generated automatically and becomes the login password.</p>
|
||||
<p className="muted small">A QR token is generated when the contact is registered for an event — it becomes the login password.</p>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user