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,9 +1,10 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { acceptConnection, getMyConnections, getPublicContacts, rejectConnection } from '../lib/api';
|
||||
import { acceptConnection, getLeaderboard, getMyConnections, getPublicContacts, rejectConnection } from '../lib/api';
|
||||
import { usePolling } from '../lib/usePolling';
|
||||
import { capWords } from '../lib/time';
|
||||
import type { Connection, PublicContact } from '../lib/types';
|
||||
import { Avatar, Empty, Spinner } from '../components/ui';
|
||||
import { Avatar, Empty, Sheet, Spinner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
|
||||
export function Connections() {
|
||||
@@ -11,14 +12,17 @@ export function Connections() {
|
||||
const [tab, setTab] = useState<'mine' | 'req'>('mine');
|
||||
const [conns, setConns] = useState<Connection[]>([]);
|
||||
const [people, setPeople] = useState<Map<string, PublicContact>>(new Map());
|
||||
const [points, setPoints] = useState<Map<string, number>>(new Map());
|
||||
const [detail, setDetail] = useState<{ email: string; status: Connection['status'] } | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const { toast } = useToast();
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try {
|
||||
const [c, p] = await Promise.all([getMyConnections(), getPublicContacts()]);
|
||||
const [c, p, lb] = await Promise.all([getMyConnections(), getPublicContacts(), getLeaderboard()]);
|
||||
setConns(c);
|
||||
setPeople(new Map(p.map((x) => [x.email, x])));
|
||||
setPoints(new Map(lb.map((x) => [x.contact_email, x.points])));
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
} finally {
|
||||
@@ -37,6 +41,7 @@ export function Connections() {
|
||||
const me = contact.email;
|
||||
const nameOf = (email: string) => people.get(email)?.full_name ?? '…';
|
||||
const typeOf = (email: string) => people.get(email)?.registration_type ?? null;
|
||||
const pointsOf = (email: string) => points.get(email) ?? 0;
|
||||
|
||||
const accepted = conns.filter((c) => c.status === 'accepted');
|
||||
const incoming = conns.filter((c) => c.status === 'pending' && c.to_email === me);
|
||||
@@ -47,6 +52,7 @@ export function Connections() {
|
||||
if (accept) await acceptConnection(id);
|
||||
else await rejectConnection(id);
|
||||
toast(accept ? 'Connected! +5 pts 🤝' : 'Request declined', accept ? 'ok' : '');
|
||||
window.dispatchEvent(new Event('connections-changed'));
|
||||
await load();
|
||||
} catch (e) {
|
||||
toast(e instanceof Error ? e.message : 'Could not update request', 'err');
|
||||
@@ -80,11 +86,13 @@ export function Connections() {
|
||||
accepted.map((c) => {
|
||||
const otherEmail = c.from_email === me ? c.to_email : c.from_email;
|
||||
return (
|
||||
<div className="conn" key={c.id}>
|
||||
<div className="conn clickable" key={c.id} onClick={() => setDetail({ email: otherEmail, status: c.status })}>
|
||||
<Avatar name={nameOf(otherEmail)} id={otherEmail} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(otherEmail)}</div>
|
||||
{typeOf(otherEmail) && <div className="meta">{typeOf(otherEmail)!.replace('_', ' ')}</div>}
|
||||
{typeOf(otherEmail) && (
|
||||
<div className="meta">{capWords(typeOf(otherEmail)!)}</div>
|
||||
)}
|
||||
</div>
|
||||
<span className="pill green">Connected</span>
|
||||
</div>
|
||||
@@ -102,10 +110,15 @@ export function Connections() {
|
||||
<div className="muted small" style={{ marginBottom: 8, fontWeight: 700 }}>Incoming</div>
|
||||
{incoming.map((c) => (
|
||||
<div className="conn" key={c.id}>
|
||||
<Avatar name={nameOf(c.from_email)} id={c.from_email} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(c.from_email)}</div>
|
||||
{typeOf(c.from_email) && <div className="meta">{typeOf(c.from_email)!.replace('_', ' ')}</div>}
|
||||
<div className="clickable" style={{ display: 'flex', alignItems: 'center', gap: 10, flex: 1 }}
|
||||
onClick={() => setDetail({ email: c.from_email, status: c.status })}>
|
||||
<Avatar name={nameOf(c.from_email)} id={c.from_email} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(c.from_email)}</div>
|
||||
{typeOf(c.from_email) && (
|
||||
<div className="meta">{capWords(typeOf(c.from_email)!)}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<button className="btn primary small" onClick={() => resolve(c.id, true)}>Accept</button>
|
||||
<button className="btn small" onClick={() => resolve(c.id, false)}>Decline</button>
|
||||
@@ -117,11 +130,13 @@ export function Connections() {
|
||||
<div>
|
||||
<div className="muted small" style={{ marginBottom: 8, fontWeight: 700 }}>Sent</div>
|
||||
{outgoing.map((c) => (
|
||||
<div className="conn" key={c.id}>
|
||||
<div className="conn clickable" key={c.id} onClick={() => setDetail({ email: c.to_email, status: c.status })}>
|
||||
<Avatar name={nameOf(c.to_email)} id={c.to_email} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(c.to_email)}</div>
|
||||
{typeOf(c.to_email) && <div className="meta">{typeOf(c.to_email)!.replace('_', ' ')}</div>}
|
||||
{typeOf(c.to_email) && (
|
||||
<div className="meta">{capWords(typeOf(c.to_email)!)}</div>
|
||||
)}
|
||||
</div>
|
||||
<span className="pill amber">Pending</span>
|
||||
</div>
|
||||
@@ -130,6 +145,32 @@ export function Connections() {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{detail && (() => {
|
||||
const p = people.get(detail.email);
|
||||
const t = p?.registration_type ?? null;
|
||||
return (
|
||||
<Sheet open onClose={() => setDetail(null)}>
|
||||
<div className="center" style={{ flexDirection: 'column', gap: 10, padding: '8px 0 20px' }}>
|
||||
<Avatar name={p?.full_name ?? '…'} id={detail.email} size={72} />
|
||||
<div className="h2" style={{ textAlign: 'center' }}>{p?.full_name ?? '…'}</div>
|
||||
<div className="row" style={{ justifyContent: 'center', gap: 8 }}>
|
||||
{t && <span className={`pill reg-${t}`}>{capWords(t)}</span>}
|
||||
<span className="pill violet">⚡ {pointsOf(detail.email)} pts</span>
|
||||
</div>
|
||||
{p?.linkedin_url && (
|
||||
<a className="link" href={p.linkedin_url} target="_blank" rel="noreferrer">
|
||||
{p.linkedin_url.replace(/^https?:\/\//, '')}
|
||||
</a>
|
||||
)}
|
||||
{p?.show_email && <div className="muted small">{detail.email}</div>}
|
||||
<div className="muted small">
|
||||
{detail.status === 'accepted' ? 'Connected' : detail.status === 'pending' ? 'Request pending' : 'Request declined'}
|
||||
</div>
|
||||
</div>
|
||||
</Sheet>
|
||||
);
|
||||
})()}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user