Implement EventStream for live schedule updates
This commit is contained in:
parent
e5aac858e4
commit
cdad188233
7 changed files with 172 additions and 36 deletions
|
@ -1,5 +1,7 @@
|
|||
import { Schedule, ScheduleEvent, ScheduleLocation, TimeSlot } from "@/app/schedule/types";
|
||||
"use client";
|
||||
import { ScheduleEvent, ScheduleLocation, TimeSlot } from "@/app/schedule/types";
|
||||
import styles from "./timetable.module.css";
|
||||
import { useSchedule } from "@/app/schedule/context";
|
||||
|
||||
const oneDayMs = 24 * 60 * 60 * 1000;
|
||||
const oneHourMs = 60 * 60 * 1000;
|
||||
|
@ -318,8 +320,8 @@ function tableElementsFromStretches(
|
|||
};
|
||||
}
|
||||
|
||||
export default function Timetable(props: { schedule: Schedule }) {
|
||||
const { locations, events } = props.schedule;
|
||||
export default function Timetable() {
|
||||
const { locations, events } = useSchedule()!;
|
||||
const junctions = junctionsFromEdges(edgesFromEvents(events));
|
||||
const stretches = [...stretchesFromSpans(spansFromJunctions(junctions, locations), oneHourMs * 5)];
|
||||
const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue