@@ -7,6 +7,7 @@ import { Anchor } from "@/app/conf/_design-system/anchor"
7
7
import { Tag } from "@/app/conf/_design-system/tag"
8
8
9
9
import { PinIcon } from "@/app/conf/_design-system/pixelarticons/pin-icon"
10
+ import ClockIcon from "@/app/conf/_design-system/pixelarticons/clock.svg?svgr"
10
11
11
12
import { getEventTitle } from "../../utils"
12
13
import { CalendarIcon } from "@/app/conf/_design-system/pixelarticons/calendar-icon"
@@ -19,10 +20,12 @@ export function ScheduleSessionCard({
19
20
session,
20
21
year,
21
22
eventsColors,
23
+ blockEnd,
22
24
} : {
23
25
session : ScheduleSession
24
26
year : `202${number } `
25
27
eventsColors : Record < string , string >
28
+ blockEnd : Date
26
29
} ) {
27
30
let eventType = session . event_type
28
31
@@ -43,6 +46,19 @@ export function ScheduleSessionCard({
43
46
44
47
const eventColor = eventsColors [ session . event_type ]
45
48
49
+ let blockTimeFraction = 1
50
+ if ( blockEnd . getTime ( ) !== new Date ( session . event_end ) . getTime ( ) ) {
51
+ blockTimeFraction =
52
+ ( new Date ( session . event_end ) . getTime ( ) -
53
+ new Date ( session . event_start ) . getTime ( ) ) /
54
+ ( blockEnd . getTime ( ) - new Date ( session . event_start ) . getTime ( ) )
55
+
56
+ console . log ( {
57
+ eventTitle,
58
+ blockTimeFraction,
59
+ } )
60
+ }
61
+
46
62
return session . event_type === "Breaks" ? (
47
63
< div className = "flex size-full items-center bg-neu-0 px-4 py-2 font-normal" >
48
64
{ eventTitle }
@@ -86,15 +102,27 @@ export function ScheduleSessionCard({
86
102
) ) }
87
103
</ span >
88
104
) }
89
- < span className = "mt-4 flex items-center justify-between gap-2 xl:mt-6" >
105
+ < span className = "mt-4 flex items-center gap-2 xl:mt-6" >
90
106
< span className = "typography-body-xs flex items-center gap-0.5" >
91
107
< PinIcon className = "size-4 text-pri-base" />
92
108
{ session . venue }
93
109
</ span >
110
+ { blockTimeFraction < 1 && (
111
+ < span className = "typography-body-xs flex items-center gap-0.5" >
112
+ < ClockIcon className = "size-4 text-pri-base" />
113
+ { Math . round (
114
+ ( new Date ( session . event_end ) . getTime ( ) -
115
+ new Date ( session . event_start ) . getTime ( ) ) /
116
+ ( 1000 * 60 ) ,
117
+ ) } { " " }
118
+ min
119
+ </ span >
120
+ ) }
94
121
< AddToCalendarLink
95
122
eventTitle = { eventTitle }
96
123
session = { session }
97
124
speakers = { session . speakers || [ ] }
125
+ className = "ml-auto"
98
126
/>
99
127
</ span >
100
128
</ span >
0 commit comments