11---
2- import dayjs from " dayjs" ;
2+ import dayjs from ' dayjs'
33import utc from ' dayjs/plugin/utc'
44import timezone from ' dayjs/plugin/timezone'
5- import { Picture } from ' astro:assets' ;
5+ import { Picture } from ' astro:assets'
66
77import { getSessionizeData } from ' $sessionize/getSessionizeData'
8- import type { Session , Speaker , Room } from " $sessionize/types" ;
9- import Base from " $layouts/base.astro" ;
10- import LogoHorizontal from " $sprites/logoHorizontal.astro" ;
8+ import type { Session , Speaker , Room } from ' $sessionize/types'
9+ import Base from ' $layouts/base.astro'
10+ import LogoHorizontal from ' $sprites/logoHorizontal.astro'
1111
1212export interface Props {
13- session: Session
14- speakers: Speaker []
15- room: Room
13+ session: Session
14+ speakers: Speaker []
15+ room: Room
1616}
1717
1818dayjs .extend (utc )
1919dayjs .extend (timezone )
2020
2121export const getStaticPaths = async () => {
22- const { sessions, speakers, rooms } = await getSessionizeData ()
23- return sessions .map (session => ({
24- params: {
25- id: session .id
26- },
27- props: {
28- session ,
29- speakers: session .speakers .map (speakerId => speakers .find (speaker => speaker .id === speakerId )),
30- room: rooms .find (room => room .id === session .roomId ),
31- }
32- }));
22+ const { sessions, speakers, rooms } = await getSessionizeData ()
23+ return sessions .map (session => ({
24+ params: {
25+ id: session .id ,
26+ },
27+ props: {
28+ session ,
29+ speakers: session .speakers .map (speakerId =>
30+ speakers .find (speaker => speaker .id === speakerId )
31+ ),
32+ room: rooms .find (room => room .id === session .roomId ),
33+ },
34+ }))
3335}
3436
35- const { session, speakers, room } = Astro .props
37+ const { session, speakers, room } = Astro .props
3638---
3739
38- <Base title =`${session .title } | JavaScript Bangkok 2.0.0` >
39- <nav class =" py-2 px-4 bg-brand-orange" >
40- <a href =" /" data-astro-prefetch >
41- <LogoHorizontal class =" h-12 text-white" />
42- </a >
43- </nav >
44- <section class =" px-8 pt-12 md:px-20 md:pt-24 pb-12 min-h-[calc(100dvh-224px)]" >
45- <div class =" grid grid-cols-1 md:grid-cols-2 gap-8" >
46- { speakers .map (speaker => (
47- <div class = " flex space-x-4 items-center" >
48- <div class = " w-20 md:w-32 aspect-square shrink-0" >
49- <Picture
50- src = { speaker .profilePicture }
51- class = " w-full aspect-square rounded-full"
52- formats = { [' avif' , ' webp' ]}
53- alt = { speaker .fullName }
54- width = " 200"
55- height = " 200"
56- />
57- </div >
58- <div >
59- <h1 class = " text-3xl md:text-4xl font-extrabold" >{ speaker .fullName } </h1 >
60- <h2 class = " md:text-lg" >{ speaker .tagLine } </h2 >
61- <div class = " flex gap-2 pt-2 flex-wrap" >
62- { speaker .links .map (link => (
63- <a href = { link .url } class = " underline" >{ link .title } </a >
64- ))}
65- </div >
66- </div >
67- </div >
68- ))}
69- </div >
70- <div class =" max-w-xl pt-8 space-y-4" >
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 >
40+ <Base title =`${session .title } | JavaScript Bangkok 2.0.1` >
41+ <nav class =" bg-brand-orange px-4 py-2" >
42+ <a href =" /" data-astro-prefetch >
43+ <LogoHorizontal class =" h-12 text-white" />
44+ </a >
45+ </nav >
46+ <section
47+ class =" min-h-[calc(100dvh-224px)] px-8 pb-12 pt-12 md:px-20 md:pt-24"
48+ >
49+ <div class =" grid grid-cols-1 gap-8 md:grid-cols-2" >
50+ {
51+ speakers .map (speaker => (
52+ <div class = " flex items-center space-x-4" >
53+ <div class = " aspect-square w-20 shrink-0 md:w-32" >
54+ <Picture
55+ src = { speaker .profilePicture }
56+ class = " aspect-square w-full rounded-full"
57+ formats = { [' avif' , ' webp' ]}
58+ alt = { speaker .fullName }
59+ width = " 200"
60+ height = " 200"
61+ />
7462 </div >
75- <p >{ session .description } </p >
76- </div >
77- </section >
78- </Base >
63+ <div >
64+ <h1 class = " text-3xl font-extrabold md:text-4xl" >
65+ { speaker .fullName }
66+ </h1 >
67+ <h2 class = " md:text-lg" >{ speaker .tagLine } </h2 >
68+ <div class = " flex flex-wrap gap-2 pt-2" >
69+ { speaker .links .map (link => (
70+ <a href = { link .url } class = " underline" >
71+ { link .title }
72+ </a >
73+ ))}
74+ </div >
75+ </div >
76+ </div >
77+ ))
78+ }
79+ </div >
80+ <div class =" max-w-xl space-y-4 pt-8" >
81+ <h1 class =" text-2xl font-bold" >{ session .title } </h1 >
82+ <div class =" flex" >
83+ <p
84+ class =" rounded bg-black px-3 py-1 font-mono text-sm font-bold text-white"
85+ >
86+ {
87+ dayjs (session .startsAt )
88+ .tz (' Asia/Bangkok' )
89+ .format (' (ddd) D MMMM YYYY, HH:mm' )
90+ } @{ room .name }
91+ </p >
92+ </div >
93+ <p >{ session .description } </p >
94+ </div >
95+ </section >
96+ </Base >
0 commit comments