1
- import { getEventTitle } from "@/app/conf/2023/utils"
1
+ import React from "react"
2
+
2
3
import { SchedSpeaker } from "@/app/conf/2023/types"
4
+ import { Anchor } from "@/app/conf/_design-system/anchor"
5
+ import { Tag } from "@/app/conf/_design-system/tag"
3
6
4
7
import { PinIcon } from "../../pixelarticons/pin-icon"
5
- import { Tag } from "@/app/conf/_design-system/tag"
6
8
7
9
import { type ScheduleSession } from "./session-list"
10
+ import { getEventTitle } from "../../utils"
8
11
9
- function isString ( x : any ) {
12
+ function isString ( x : unknown ) : x is string {
10
13
return Object . prototype . toString . call ( x ) === "[object String]"
11
14
}
12
15
@@ -26,14 +29,16 @@ export function ScheduleSessionCard({
26
29
: session . event_type
27
30
28
31
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
+ : [ ]
32
38
33
39
const eventTitle = getEventTitle (
34
- // @ts -expect-error fixme
35
40
session ,
36
- formattedSpeakers ,
41
+ speakers . map ( s => s . name ) ,
37
42
)
38
43
39
44
const eventColor = eventsColors [ session . event_type ]
@@ -50,6 +55,7 @@ export function ScheduleSessionCard({
50
55
href = { `/conf/${ year } /schedule/${ session . id } ?name=${ session . name } ` }
51
56
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"
52
57
>
58
+ { /* todo: fix link nesting */ }
53
59
< span className = "flex h-full flex-col justify-start" >
54
60
{ eventColor && (
55
61
< Tag className = "mb-3" color = { eventColor } >
@@ -61,12 +67,25 @@ export function ScheduleSessionCard({
61
67
< span className = "typography-body-md" > { eventTitle } </ span >
62
68
< span className = "flex flex-col" >
63
69
{ ( 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
+ ) ) }
67
86
</ span >
68
87
) }
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" >
70
89
< PinIcon className = "size-4 text-pri-base" />
71
90
{ session . venue }
72
91
</ span >
0 commit comments