1- import { getEventTitle } from "@/app/conf/2023/utils"
1+ import React from "react"
2+
23import { SchedSpeaker } from "@/app/conf/2023/types"
4+ import { Anchor } from "@/app/conf/_design-system/anchor"
5+ import { Tag } from "@/app/conf/_design-system/tag"
36
47import { PinIcon } from "../../pixelarticons/pin-icon"
5- import { Tag } from "@/app/conf/_design-system/tag"
68
79import { type ScheduleSession } from "./session-list"
10+ import { getEventTitle } from "../../utils"
811
9- function isString ( x : any ) {
12+ function isString ( x : unknown ) : x is string {
1013 return Object . prototype . toString . call ( x ) === "[object String]"
1114}
1215
@@ -26,14 +29,16 @@ export function ScheduleSessionCard({
2629 : session . event_type
2730
2831 const speakers = session . speakers
29- const formattedSpeakers = isString ( speakers || [ ] )
30- ? ( speakers as string ) ?. split ( "," )
31- : ( speakers as SchedSpeaker [ ] ) ?. map ( e => e . name )
32+ ? isString ( session . speakers )
33+ ? ( session . speakers as string )
34+ . split ( "," )
35+ . map ( name => ( { name, username : "" } ) )
36+ : ( session . speakers as SchedSpeaker [ ] )
37+ : [ ]
3238
3339 const eventTitle = getEventTitle (
34- // @ts -expect-error fixme
3540 session ,
36- formattedSpeakers ,
41+ speakers . map ( s => s . name ) ,
3742 )
3843
3944 const eventColor = eventsColors [ session . event_type ]
@@ -50,6 +55,7 @@ export function ScheduleSessionCard({
5055 href = { `/conf/${ year } /schedule/${ session . id } ?name=${ session . name } ` }
5156 className = "group relative size-full bg-neu-0 p-4 font-normal no-underline ring-neu-400 hover:bg-neu-0/90 hover:ring-1 focus-visible:z-[1] dark:ring-neu-100 dark:hover:bg-neu-0/80 max-lg:mt-px"
5257 >
58+ { /* todo: fix link nesting */ }
5359 < span className = "flex h-full flex-col justify-start" >
5460 { eventColor && (
5561 < Tag className = "mb-3" color = { eventColor } >
@@ -61,12 +67,25 @@ export function ScheduleSessionCard({
6167 < span className = "typography-body-md" > { eventTitle } </ span >
6268 < span className = "flex flex-col" >
6369 { ( speakers ?. length || 0 ) > 0 && (
64- < span className = "typography-body-sm" >
65- { /* todo: link to speakers (anchor background on z-index above the main link layer) */ }
66- { formattedSpeakers . join ( ", " ) }
70+ < span className = "typography-body-sm z-[2]" >
71+ { speakers . map ( ( s , i ) => (
72+ < React . Fragment key = { s . username || s . name } >
73+ { s . username ? (
74+ < Anchor
75+ href = { `/conf/${ year } /speakers/${ s . username } ` }
76+ className = "decoration-neu-500 hover:underline dark:decoration-neu-100"
77+ >
78+ { s . name }
79+ </ Anchor >
80+ ) : (
81+ s . name
82+ ) }
83+ { i !== speakers . length - 1 && < span > , </ span > }
84+ </ React . Fragment >
85+ ) ) }
6786 </ span >
6887 ) }
69- < span className = "mt-2 flex items-center gap-0.5 typography-body-xs " >
88+ < span className = "typography-body-xs mt-2 flex items-center gap-0.5" >
7089 < PinIcon className = "size-4 text-pri-base" />
7190 { session . venue }
7291 </ span >
0 commit comments