|
1 | 1 | ---
|
| 2 | +import dayjs from "dayjs"; |
| 3 | +import utc from 'dayjs/plugin/utc' |
| 4 | +import timezone from 'dayjs/plugin/timezone' |
2 | 5 | import { Picture } from 'astro:assets';
|
3 | 6 |
|
4 | 7 | import { getSessionizeData } from '$sessionize/getSessionizeData'
|
5 |
| -import type { Session, Speaker } from "$sessionize/types"; |
| 8 | +import type { Session, Speaker, Room } from "$sessionize/types"; |
6 | 9 | import Base from "$layouts/base.astro";
|
7 | 10 | import LogoHorizontal from "$sprites/logoHorizontal.astro";
|
8 | 11 |
|
9 | 12 | export interface Props {
|
10 | 13 | session: Session
|
11 | 14 | speakers: Speaker[]
|
| 15 | + room: Room |
12 | 16 | }
|
13 | 17 |
|
| 18 | +dayjs.extend(utc) |
| 19 | +dayjs.extend(timezone) |
| 20 | +
|
14 | 21 | export const getStaticPaths = async () => {
|
15 |
| - const { sessions, speakers } = await getSessionizeData() |
| 22 | + const { sessions, speakers, rooms } = await getSessionizeData() |
16 | 23 | return sessions.map(session => ({
|
17 | 24 | params: {
|
18 | 25 | id: session.id
|
19 | 26 | },
|
20 | 27 | props: {
|
21 | 28 | session,
|
22 |
| - speakers: session.speakers.map(speakerId => speakers.find(speaker => speaker.id === speakerId)) |
| 29 | + speakers: session.speakers.map(speakerId => speakers.find(speaker => speaker.id === speakerId)), |
| 30 | + room: rooms.find(room => room.id === session.roomId), |
23 | 31 | }
|
24 | 32 | }));
|
25 | 33 | }
|
26 | 34 |
|
27 |
| -const { session, speakers } = Astro.props |
| 35 | +const { session, speakers, room } = Astro.props |
28 | 36 | ---
|
29 | 37 |
|
30 | 38 | <Base title=`${session.title} | JavaScript Bangkok 2.0.0`>
|
@@ -61,6 +69,9 @@ const { session, speakers } = Astro.props
|
61 | 69 | </div>
|
62 | 70 | <div class="max-w-xl pt-8 space-y-4">
|
63 | 71 | <h1 class="font-bold text-2xl">{session.title}</h1>
|
| 72 | + <div class="flex"> |
| 73 | + <p class="font-mono text-white bg-black rounded py-1 px-3 text-sm font-bold">{dayjs(session.startsAt).tz('Asia/Bangkok').format("(ddd) D MMMM YYYY, HH:mm")} @{room.name}</p> |
| 74 | + </div> |
64 | 75 | <p>{session.description}</p>
|
65 | 76 | </div>
|
66 | 77 | </section>
|
|
0 commit comments