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,29 +1,34 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getAgenda, groupAgenda } from './api';
|
||||
import { getActiveEvent, getAgenda, groupAgenda } from './api';
|
||||
import { DEFAULT_NOW } from './time';
|
||||
import type { Session, Slot } from './types';
|
||||
import type { Event, Session, Slot } from './types';
|
||||
|
||||
export interface EventData {
|
||||
event: Event | null;
|
||||
slots: { slot: Slot; sessions: Session[] }[];
|
||||
sessionById: Map<string, Session>;
|
||||
slotById: Map<number, Slot>;
|
||||
now: Date;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
reload: () => void;
|
||||
}
|
||||
|
||||
/** Loads the agenda once and exposes it grouped by slot, plus the event clock. */
|
||||
/** Loads the active event + agenda, exposes them grouped by slot, plus the event clock. */
|
||||
export function useEvent(): EventData {
|
||||
const [event, setEvent] = useState<Event | null>(null);
|
||||
const [slots, setSlots] = useState<{ slot: Slot; sessions: Session[] }[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [nonce, setNonce] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
(async () => {
|
||||
try {
|
||||
const rows = await getAgenda();
|
||||
const [ev, rows] = await Promise.all([getActiveEvent(), getAgenda()]);
|
||||
if (!active) return;
|
||||
setEvent(ev);
|
||||
setSlots(groupAgenda(rows));
|
||||
} catch (e) {
|
||||
if (active) setError(e instanceof Error ? e.message : 'Failed to load agenda');
|
||||
@@ -34,7 +39,7 @@ export function useEvent(): EventData {
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
}, [nonce]);
|
||||
|
||||
const sessionById = new Map<string, Session>();
|
||||
const slotById = new Map<number, Slot>();
|
||||
@@ -43,5 +48,14 @@ export function useEvent(): EventData {
|
||||
for (const s of sessions) sessionById.set(s.id, s);
|
||||
}
|
||||
|
||||
return { slots, sessionById, slotById, now: DEFAULT_NOW, loading, error };
|
||||
return {
|
||||
event,
|
||||
slots,
|
||||
sessionById,
|
||||
slotById,
|
||||
now: DEFAULT_NOW,
|
||||
loading,
|
||||
error,
|
||||
reload: () => setNonce((n) => n + 1),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user