owltide/app/schedule/page.tsx

39 lines
1.1 KiB
TypeScript
Raw Normal View History

import Timetable from "@/ui/timetable"
import styles from "./page.module.css"
2025-02-26 23:56:19 +01:00
import { Schedule, ScheduleEvent } from "./types"
import { readFile } from "fs/promises"
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>
}
2025-02-26 23:56:19 +01:00
export default async function schedule() {
const schedule: Schedule = JSON.parse(await readFile("schedule.json", "utf-8"));
return <main className={styles.schedule}>
<h1>Schedule & Events</h1>
<p>
Study carefully, we only hold these events once a year.
</p>
<h2>Schedule</h2>
2025-02-26 23:56:19 +01:00
<Timetable schedule={schedule} />
<h2>Events</h2>
2025-02-26 23:56:19 +01:00
{schedule.events.map(event => <EventInfo event={event} key={event.id}/>)}
<h2>Locations</h2>
<ul>
2025-02-26 23:56:19 +01:00
{schedule.locations.map(location => <li key={location.id}>
<h3>{location.name}</h3>
{location.description ?? "No description provided"}
</li>)}
</ul>
</main>
}