Redesign Phases 3-6: multi-event model, APPE Admin, Convivo App behaviors, APPE branding
- Phase 3: new migration 20260824000000_redesign.sql (contacts/events/registrations/sponsors, slot types, session speakers + feedback/material), seed rewrite - Phase 4: APPE Admin rebrand + Contacts/Registrations/Sponsors/Schedule/Activity/Events views - Phase 5: Convivo App (24h login, 5s polling, QR type badge, red dot, speaker material) - Phase 6: APPE favicon + PWA icons for both apps - Docs: schema/rpcs/rls/seed/screens/api-client/admin-app/architecture/next-steps/README/roadmap updated
This commit is contained in:
1 parent
5adb5785aa
commit
22f5f1d317
64 files changed
+4593
-1371
No files matched your search
@@ -1,23 +1,24 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { acceptConnection, getMyConnections, getPublicProfiles, rejectConnection } from '../lib/api';
|
||||
import type { Connection, PublicProfile } from '../lib/types';
|
||||
import { acceptConnection, getMyConnections, getPublicContacts, rejectConnection } from '../lib/api';
|
||||
import { usePolling } from '../lib/usePolling';
|
||||
import type { Connection, PublicContact } from '../lib/types';
|
||||
import { Avatar, Empty, Spinner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
|
||||
export function Connections() {
|
||||
const { profile } = useAuth();
|
||||
const { contact } = useAuth();
|
||||
const [tab, setTab] = useState<'mine' | 'req'>('mine');
|
||||
const [conns, setConns] = useState<Connection[]>([]);
|
||||
const [people, setPeople] = useState<Map<string, PublicProfile>>(new Map());
|
||||
const [people, setPeople] = useState<Map<string, PublicContact>>(new Map());
|
||||
const [loading, setLoading] = useState(true);
|
||||
const { toast } = useToast();
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try {
|
||||
const [c, p] = await Promise.all([getMyConnections(), getPublicProfiles()]);
|
||||
const [c, p] = await Promise.all([getMyConnections(), getPublicContacts()]);
|
||||
setConns(c);
|
||||
setPeople(new Map(p.map((x) => [x.id, x])));
|
||||
setPeople(new Map(p.map((x) => [x.email, x])));
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
} finally {
|
||||
@@ -29,14 +30,17 @@ export function Connections() {
|
||||
void load();
|
||||
}, [load]);
|
||||
|
||||
if (!profile) return null;
|
||||
const me = profile.id;
|
||||
const nameOf = (id: string) => people.get(id)?.full_name ?? '…';
|
||||
const companyOf = (id: string) => people.get(id)?.company ?? '';
|
||||
// Live-ish updates: poll every 5s while the tab is visible.
|
||||
usePolling(() => void load(), 5000, !loading);
|
||||
|
||||
if (!contact) return null;
|
||||
const me = contact.email;
|
||||
const nameOf = (email: string) => people.get(email)?.full_name ?? '…';
|
||||
const typeOf = (email: string) => people.get(email)?.registration_type ?? null;
|
||||
|
||||
const accepted = conns.filter((c) => c.status === 'accepted');
|
||||
const incoming = conns.filter((c) => c.status === 'pending' && c.to_id === me);
|
||||
const outgoing = conns.filter((c) => c.status === 'pending' && c.from_id === me);
|
||||
const incoming = conns.filter((c) => c.status === 'pending' && c.to_email === me);
|
||||
const outgoing = conns.filter((c) => c.status === 'pending' && c.from_email === me);
|
||||
|
||||
async function resolve(id: string, accept: boolean) {
|
||||
try {
|
||||
@@ -74,13 +78,13 @@ export function Connections() {
|
||||
<Empty icon="🤝" text="No connections yet. Scan a peer’s lanyard to start one." />
|
||||
) : (
|
||||
accepted.map((c) => {
|
||||
const otherId = c.from_id === me ? c.to_id : c.from_id;
|
||||
const otherEmail = c.from_email === me ? c.to_email : c.from_email;
|
||||
return (
|
||||
<div className="conn" key={c.id}>
|
||||
<Avatar name={nameOf(otherId)} id={otherId} size={44} />
|
||||
<Avatar name={nameOf(otherEmail)} id={otherEmail} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(otherId)}</div>
|
||||
<div className="meta">{companyOf(otherId)}</div>
|
||||
<div className="name">{nameOf(otherEmail)}</div>
|
||||
{typeOf(otherEmail) && <div className="meta">{typeOf(otherEmail)!.replace('_', ' ')}</div>}
|
||||
</div>
|
||||
<span className="pill green">Connected</span>
|
||||
</div>
|
||||
@@ -98,10 +102,10 @@ 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_id)} id={c.from_id} size={44} />
|
||||
<Avatar name={nameOf(c.from_email)} id={c.from_email} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(c.from_id)}</div>
|
||||
<div className="meta">{companyOf(c.from_id)}</div>
|
||||
<div className="name">{nameOf(c.from_email)}</div>
|
||||
{typeOf(c.from_email) && <div className="meta">{typeOf(c.from_email)!.replace('_', ' ')}</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>
|
||||
@@ -114,10 +118,10 @@ export function Connections() {
|
||||
<div className="muted small" style={{ marginBottom: 8, fontWeight: 700 }}>Sent</div>
|
||||
{outgoing.map((c) => (
|
||||
<div className="conn" key={c.id}>
|
||||
<Avatar name={nameOf(c.to_id)} id={c.to_id} size={44} />
|
||||
<Avatar name={nameOf(c.to_email)} id={c.to_email} size={44} />
|
||||
<div className="grow">
|
||||
<div className="name">{nameOf(c.to_id)}</div>
|
||||
<div className="meta">{companyOf(c.to_id)}</div>
|
||||
<div className="name">{nameOf(c.to_email)}</div>
|
||||
{typeOf(c.to_email) && <div className="meta">{typeOf(c.to_email)!.replace('_', ' ')}</div>}
|
||||
</div>
|
||||
<span className="pill amber">Pending</span>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user