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:
1 parent
bd67debeef
commit
f9a8513620
11 files changed
+113
-23
No files matched your search
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user