Move schedule data to JSON file
This commit is contained in:
parent
cb2ad42915
commit
99d04f4b43
5 changed files with 136 additions and 122 deletions
|
@ -1,6 +1,7 @@
|
|||
import Timetable from "@/ui/timetable"
|
||||
import styles from "./page.module.css"
|
||||
import { ScheduleEvent, events, locations } from "./events"
|
||||
import { Schedule, ScheduleEvent } from "./types"
|
||||
import { readFile } from "fs/promises"
|
||||
|
||||
function EventInfo(props: { event: ScheduleEvent }) {
|
||||
return <section className={styles.event}>
|
||||
|
@ -15,19 +16,20 @@ function EventInfo(props: { event: ScheduleEvent }) {
|
|||
</section>
|
||||
}
|
||||
|
||||
export default function schedule() {
|
||||
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>
|
||||
<Timetable events={events} />
|
||||
<Timetable schedule={schedule} />
|
||||
<h2>Events</h2>
|
||||
{events.map(event => <EventInfo event={event} key={event.id}/>)}
|
||||
{schedule.events.map(event => <EventInfo event={event} key={event.id}/>)}
|
||||
<h2>Locations</h2>
|
||||
<ul>
|
||||
{locations.map(location => <li key={location.id}>
|
||||
{schedule.locations.map(location => <li key={location.id}>
|
||||
<h3>{location.name}</h3>
|
||||
{location.description ?? "No description provided"}
|
||||
</li>)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue