Implement EventStream for live schedule updates

This commit is contained in:
Hornwitser 2025-02-27 15:42:59 +01:00
parent e5aac858e4
commit cdad188233
7 changed files with 172 additions and 36 deletions

24
ui/events.tsx Normal file
View file

@ -0,0 +1,24 @@
"use client";
import styles from "./events.module.css"
import { useSchedule } from "@/app/schedule/context";
import { ScheduleEvent } from "@/app/schedule/types";
function EventInfo(props: { event: ScheduleEvent }) {
return <section className={styles.event}>
<h3>{props.event.name}</h3>
<p>{props.event.description ?? "No description provided"}</p>
<h4>Timeslots</h4>
<ul>
{props.event.slots.map(slot => <li key={slot.id}>
{slot.start} - {slot.end}
</li>)}
</ul>
</section>
}
export function Events() {
const schedule = useSchedule();
return <>
{schedule!.events.map(event => <EventInfo event={event} key={event.id}/>)}
</>;
}