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 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
2f53d47578
commit
7605c9bbf4
64 files changed
+4593
-1371
No files matched your search
@@ -1,26 +1,45 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useEvent } from '../lib/useEvent';
|
||||
import { clearPreference, getMyCheckins, getMyPreferences, setPreference } from '../lib/api';
|
||||
import {
|
||||
clearPreference,
|
||||
getMyCheckins,
|
||||
getMyPreferences,
|
||||
getMySpeakerSessions,
|
||||
sessionMaterialUrl,
|
||||
setPreference,
|
||||
uploadSessionMaterial,
|
||||
} from '../lib/api';
|
||||
import { fmtRange, slotStatus } from '../lib/time';
|
||||
import type { Preference, Session } from '../lib/types';
|
||||
import { Sheet, Spinner } from '../components/ui';
|
||||
import { useToast } from '../context/ToastContext';
|
||||
|
||||
export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) => void }) {
|
||||
const { slots, now, loading } = useEvent();
|
||||
const { contact } = useAuth();
|
||||
const { event, slots, now, loading, reload } = useEvent();
|
||||
const [prefs, setPrefs] = useState<Preference[]>([]);
|
||||
const [checkins, setCheckins] = useState<string[]>([]);
|
||||
const [mySpeakerSessions, setMySpeakerSessions] = useState<string[]>([]);
|
||||
const [selected, setSelected] = useState<Session | null>(null);
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
const { toast } = useToast();
|
||||
|
||||
const email = contact?.email ?? '';
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
(async () => {
|
||||
try {
|
||||
const [p, c] = await Promise.all([getMyPreferences(), getMyCheckins()]);
|
||||
const [p, c, sp] = await Promise.all([
|
||||
getMyPreferences(),
|
||||
getMyCheckins(email),
|
||||
getMySpeakerSessions(email),
|
||||
]);
|
||||
if (!active) return;
|
||||
setPrefs(p);
|
||||
setCheckins(c);
|
||||
setMySpeakerSessions(sp);
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
}
|
||||
@@ -28,7 +47,7 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
}, [email]);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -40,6 +59,20 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
);
|
||||
}
|
||||
|
||||
if (!event) {
|
||||
return (
|
||||
<section className="screen">
|
||||
<div className="h1">Agenda</div>
|
||||
<div className="card" style={{ marginTop: 16 }}>
|
||||
<div className="empty">
|
||||
<div className="big">📅</div>
|
||||
No active event right now.
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
const pickFor = (slotId: number) => prefs.find((p) => p.slot_id === slotId)?.session_id;
|
||||
|
||||
async function togglePick(slotId: number, sessionId: string) {
|
||||
@@ -62,15 +95,33 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
const selSlot = selected ? slots.find((s) => s.slot.id === selected.slot_id)?.slot : undefined;
|
||||
const selStatus = selSlot ? slotStatus(selSlot, now) : 'next';
|
||||
const selCheckedIn = selected ? checkins.includes(selected.id) : false;
|
||||
const selISpeaker = selected ? mySpeakerSessions.includes(selected.id) : false;
|
||||
const selNeedsMaterial = selISpeaker && !selected?.material_path;
|
||||
|
||||
async function handleUpload(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file || !selected) return;
|
||||
try {
|
||||
await uploadSessionMaterial(selected.id, file);
|
||||
toast('Material uploaded ✓', 'ok');
|
||||
setSelected(null);
|
||||
// Refresh agenda so material_path updates.
|
||||
reload();
|
||||
} catch (err) {
|
||||
toast(err instanceof Error ? err.message : 'Upload failed', 'err');
|
||||
} finally {
|
||||
if (fileRef.current) fileRef.current.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="screen">
|
||||
<div className="row between">
|
||||
<div>
|
||||
<div className="h1">Agenda</div>
|
||||
<div className="muted small">Wed 23 Oct · 09:00–17:00</div>
|
||||
<div className="muted small">{event.name}</div>
|
||||
</div>
|
||||
<span className="pill violet">6 slots · 3 tracks</span>
|
||||
<span className="pill violet">{slots.length} slots</span>
|
||||
</div>
|
||||
<div className="muted small" style={{ marginTop: -4 }}>
|
||||
Pick <b>one session per slot</b> — you can change until the slot starts.
|
||||
@@ -83,7 +134,9 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
<div className="slot-card" key={slot.id}>
|
||||
<div className="slot-head">
|
||||
<div className="grow">
|
||||
<div className="name">{slot.name}</div>
|
||||
<div className="name">
|
||||
{slot.name} <span className={`pill slot-type-${slot.type}`}>{slot.type.replace('_', ' ')}</span>
|
||||
</div>
|
||||
<div className="time">{fmtRange(slot)}</div>
|
||||
</div>
|
||||
{status === 'done' && <span className="pill">Done</span>}
|
||||
@@ -92,16 +145,17 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
</div>
|
||||
{sessions.map((s) => {
|
||||
const picked = pickFor(slot.id) === s.id;
|
||||
const isMySession = mySpeakerSessions.includes(s.id);
|
||||
return (
|
||||
<button
|
||||
key={s.id}
|
||||
className={`sess ${picked ? 'picked' : ''}`}
|
||||
onClick={() => setSelected(s)}
|
||||
>
|
||||
<button key={s.id} className={`sess ${picked ? 'picked' : ''}`} onClick={() => setSelected(s)}>
|
||||
<div className="grow">
|
||||
<div className="title">{s.title}</div>
|
||||
<div className="title">
|
||||
{s.title}
|
||||
{isMySession && <span className="pill speaker-tag" style={{ marginLeft: 6 }}>🎤 you</span>}
|
||||
</div>
|
||||
<div className="meta">
|
||||
{s.room} · {s.speakers}
|
||||
{s.material_path && <span style={{ marginLeft: 6 }}>📎</span>}
|
||||
</div>
|
||||
</div>
|
||||
<span className="check">✓</span>
|
||||
@@ -128,11 +182,30 @@ export function Agenda({ openFeedback }: { openFeedback: (sessionId: string) =>
|
||||
<div className="muted small" id="sd-desc" style={{ margin: '12px 0', lineHeight: 1.55 }}>
|
||||
{selected.description}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 8, marginBottom: 14 }}>
|
||||
<div className="row" style={{ gap: 8, marginBottom: 14, flexWrap: 'wrap' }}>
|
||||
<span className="pill">🎤 {selected.speakers}</span>
|
||||
{selected.capacity && <span className="pill">👥 {selected.capacity}</span>}
|
||||
{selCheckedIn && <span className="pill green">✓ Checked in</span>}
|
||||
</div>
|
||||
|
||||
{/* Speaker material: non-dismissible notification until uploaded. */}
|
||||
{selNeedsMaterial && (
|
||||
<div className="material-notice">
|
||||
<div className="mn-title">📎 Upload your session material</div>
|
||||
<div className="muted small" style={{ marginBottom: 10 }}>
|
||||
Attendees can download your slides/notes from this session.
|
||||
</div>
|
||||
<input ref={fileRef} type="file" className="input" onChange={handleUpload} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Material download (all attendees). */}
|
||||
{selected.material_path && (
|
||||
<a className="btn primary" href={sessionMaterialUrl(selected.material_path)} target="_blank" rel="noreferrer">
|
||||
📎 Download material
|
||||
</a>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{selStatus === 'done' && selCheckedIn && (
|
||||
<button className="btn primary" onClick={() => openFeedback(selected.id)}>
|
||||
|
||||
Reference in new issue
Block a user