Real-time clock toggle: per-event use_realtime_clock flag

- Migration 20260834000000: events.use_realtime_clock (boolean, default false)
- Admin: Real-time clock toggle in the Events create/edit modal
- Convivo: useEvent picks new Date() vs simulated DEFAULT_NOW from the flag;
  Home shows a 'Demo clock' badge only in simulated mode
- Docs: app-structure, admin-app, schema, next-steps

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-25 09:22:28 +02:00
1 parent bd67debeef
commit f9a8513620
11 files changed
+113 -23

No files matched your search

+1
View File
@@ -152,6 +152,7 @@ export async function upsertEvent(
end_date: string;
location?: string | null;
sessionize_endpoint?: string | null;
use_realtime_clock?: boolean;
},
): Promise<void> {
if (id) {
+2
View File
@@ -31,6 +31,8 @@ export interface Event {
end_date: string;
location: string | null;
is_active: boolean;
/** When true, the Convivo app uses the real system clock for slot status. */
use_realtime_clock: boolean;
/** Sessionize API URL for this event (e.g. .../api/v2/<id>/view/All). */
sessionize_endpoint: string | null;
/** When the Sessionize sync last ran for this event. */
+15
View File
@@ -174,6 +174,7 @@ function EventModal({
const [endDate, setEndDate] = useState(event ? event.end_date.slice(0, 10) : '');
const [location, setLocation] = useState(event?.location ?? '');
const [endpoint, setEndpoint] = useState(event?.sessionize_endpoint ?? '');
const [realtimeClock, setRealtimeClock] = useState(event?.use_realtime_clock ?? false);
const [busy, setBusy] = useState(false);
async function save() {
@@ -186,6 +187,7 @@ function EventModal({
end_date: endDate,
location: location.trim() || null,
sessionize_endpoint: endpoint.trim() || null,
use_realtime_clock: realtimeClock,
});
onSaved(event ? 'Event updated' : 'Event created');
} catch (e) {
@@ -242,6 +244,19 @@ function EventModal({
“Run sync” button. You can also import the .xlsx export in the Interfaces menu.
</div>
</div>
<div className="field">
<div className="row between" style={{ alignItems: 'center' }}>
<div>
<label>Real-time clock</label>
<div className="muted small" style={{ marginTop: 2 }}>
{realtimeClock
? 'The app uses the real system clock for Live/Next/Done.'
: 'The app uses a simulated mid-event clock (demo always looks live).'}
</div>
</div>
<Toggle checked={realtimeClock} onChange={setRealtimeClock} label={realtimeClock ? 'On' : 'Off'} />
</div>
</div>
</Modal>
);
}
+2
View File
@@ -33,6 +33,8 @@ export interface Event {
end_date: string;
location: string | null;
is_active: boolean;
/** When true, the app uses the real system clock for slot status (Live/Next/Done). */
use_realtime_clock: boolean;
avg_feedback: number | null;
num_sessions: number;
num_speakers: number;
+9 -1
View File
@@ -9,6 +9,8 @@ export interface EventData {
sessionById: Map<string, Session>;
slotById: Map<number, Slot>;
now: Date;
/** Which clock drives slot status: the simulated mid-event clock or the real one. */
clockMode: 'simulated' | 'realtime';
loading: boolean;
error: string | null;
reload: () => void;
@@ -48,12 +50,18 @@ export function useEvent(): EventData {
for (const s of sessions) sessionById.set(s.id, s);
}
// The event's `use_realtime_clock` flag decides the clock: the real system
// time, or the simulated mid-event clock (so the demo always looks live).
const clockMode: 'simulated' | 'realtime' = event?.use_realtime_clock ? 'realtime' : 'simulated';
const now = clockMode === 'realtime' ? new Date() : DEFAULT_NOW;
return {
event,
slots,
sessionById,
slotById,
now: DEFAULT_NOW,
now,
clockMode,
loading,
error,
reload: () => setNonce((n) => n + 1),
+6 -1
View File
@@ -44,7 +44,7 @@ function ConcurrentList({ sessions }: { sessions: Session[] }) {
export function Home({ go }: { go: (tab: string) => void }) {
const { contact, registration } = useAuth();
const { event, slots, sessionById, slotById, now, loading } = useEvent();
const { event, slots, sessionById, slotById, now, clockMode, loading } = useEvent();
const [prefs, setPrefs] = useState<Preference[]>([]);
const [checkins, setCheckins] = useState<string[]>([]);
const [mySpeakerSessions, setMySpeakerSessions] = useState<string[]>([]);
@@ -141,6 +141,11 @@ export function Home({ go }: { go: (tab: string) => void }) {
<div>
<div className="h1">{greeting(now)}, {firstName} 👋</div>
<div className="muted small">{event.name}</div>
{clockMode === 'simulated' && (
<div className="muted small" style={{ marginTop: 2 }}>
🎬 Demo clock
</div>
)}
</div>
<div className="row" style={{ gap: 8 }}>
{pendingMaterial.length > 0 && (