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:
committed 2026-08-23 02:53:16 +02:00
1 parent 2f53d47578
commit 7605c9bbf4
64 files changed
+4593 -1371

No files matched your search

+205
View File
@@ -0,0 +1,205 @@
import { useEffect, useState } from 'react';
import { activateEvent, getAllEvents, upsertEvent } from '../lib/api';
import type { Event } from '../lib/types';
import { useToast } from '../context/ToastContext';
import { Empty, Modal, Spinner } from '../components/ui';
export function Events() {
const { push } = useToast();
const [events, setEvents] = useState<Event[]>([]);
const [loaded, setLoaded] = useState(false);
const [error, setError] = useState<string | null>(null);
const [modal, setModal] = useState<{ event: Event | null } | null>(null);
const [busy, setBusy] = useState(false);
async function load() {
try {
setEvents(await getAllEvents());
setLoaded(true);
} catch (e) {
setError(e instanceof Error ? e.message : 'Failed to load');
}
}
useEffect(() => {
load();
}, []);
async function doActivate(ev: Event) {
if (!confirm(`Set "${ev.name}" as the active event? All other events will be deactivated.`)) return;
setBusy(true);
try {
await activateEvent(ev.id);
await load();
push('success', `${ev.name} is now active`);
} catch (e) {
push('error', e instanceof Error ? e.message : 'Failed to activate');
} finally {
setBusy(false);
}
}
if (error) return <Empty icon="⚠️" text={error} />;
if (!loaded)
return (
<div className="loading-screen">
<Spinner />
</div>
);
return (
<div>
<div className="page-head">
<div>
<h1>Events</h1>
<div className="sub">
{events.length} event{events.length === 1 ? '' : 's'} · only one can be active at a time.
</div>
</div>
<button className="btn primary" onClick={() => setModal({ event: null })}>
+ New event
</button>
</div>
<div className="card">
{events.length === 0 ? (
<Empty icon="📅" text="No events yet. Create one to get started." />
) : (
<div className="table-wrap">
<table className="data">
<thead>
<tr>
<th>Event</th>
<th>Dates</th>
<th>Location</th>
<th>Stats</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{events.map((ev) => (
<tr key={ev.id}>
<td>
<div style={{ fontWeight: 700 }}>{ev.name}</div>
{ev.is_active && <span className="pill green">active</span>}
</td>
<td className="muted">
{fmtDate(ev.start_date)} – {fmtDate(ev.end_date)}
</td>
<td className="muted">{ev.location || '—'}</td>
<td className="muted small">
{ev.num_registrations} reg · {ev.num_sessions} sessions · {ev.num_speakers} speakers
{ev.avg_feedback != null && ` · ⭐ ${ev.avg_feedback.toFixed(1)}`}
</td>
<td>
{ev.is_active ? (
<span className="pill green">Active</span>
) : (
<button className="btn small" disabled={busy} onClick={() => doActivate(ev)}>
Set active
</button>
)}
</td>
<td>
<button className="btn small" onClick={() => setModal({ event: ev })}>
Edit
</button>
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
{modal && (
<EventModal
event={modal.event}
onClose={() => setModal(null)}
onSaved={async (msg) => {
setModal(null);
await load();
push('success', msg);
}}
/>
)}
</div>
);
}
function EventModal({
event,
onClose,
onSaved,
}: {
event: Event | null;
onClose: () => void;
onSaved: (msg: string) => void;
}) {
const [name, setName] = useState(event?.name ?? '');
const [startDate, setStartDate] = useState(event ? event.start_date.slice(0, 10) : '');
const [endDate, setEndDate] = useState(event ? event.end_date.slice(0, 10) : '');
const [location, setLocation] = useState(event?.location ?? '');
const [busy, setBusy] = useState(false);
async function save() {
if (!name.trim() || !startDate || !endDate) return;
setBusy(true);
try {
await upsertEvent(event?.id ?? null, {
name: name.trim(),
start_date: startDate,
end_date: endDate,
location: location.trim() || null,
});
onSaved(event ? 'Event updated' : 'Event created');
} catch (e) {
onSaved(e instanceof Error ? e.message : 'Save failed');
} finally {
setBusy(false);
}
}
return (
<Modal
open
title={event ? 'Edit event' : 'New event'}
onClose={onClose}
footer={
<>
<button className="btn" onClick={onClose}>
Cancel
</button>
<button className="btn primary" disabled={busy || !name.trim() || !startDate || !endDate} onClick={save}>
{busy ? 'Saving…' : 'Save'}
</button>
</>
}
>
<div className="field">
<label>Name</label>
<input className="input" value={name} onChange={(e) => setName(e.target.value)} placeholder="e.g. APPE 2027" />
</div>
<div className="grid-2">
<div className="field">
<label>Start date</label>
<input className="input" type="date" value={startDate} onChange={(e) => setStartDate(e.target.value)} />
</div>
<div className="field">
<label>End date</label>
<input className="input" type="date" value={endDate} onChange={(e) => setEndDate(e.target.value)} />
</div>
</div>
<div className="field">
<label>Location</label>
<input className="input" value={location} onChange={(e) => setLocation(e.target.value)} placeholder="—" />
</div>
</Modal>
);
}
function fmtDate(d: string): string {
return new Date(d + 'T00:00:00').toLocaleDateString([], { month: 'short', day: 'numeric', year: 'numeric' });
}