Skip to content

Commit 5aa99aa

Browse files
authored
conf — solutions showcase time (#2109)
* Show time range for very long sessions * Move end time into cards in blocks with different end times
1 parent b600a58 commit 5aa99aa

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

src/app/conf/2025/schedule/_components/schedule-list.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ export function ScheduleList({
223223
blockEnd.getTime() === nextBlockStart?.getTime() &&
224224
!isBreak
225225

226+
const endTimesDiffer = sessions.some(
227+
session =>
228+
new Date(session.event_end).getTime() !==
229+
blockEnd.getTime(),
230+
)
231+
226232
return (
227233
<div
228234
key={`concurrent sessions on ${sessionDate}`}
@@ -231,7 +237,10 @@ export function ScheduleList({
231237
<div className="mr-px flex flex-col max-lg:ml-px lg:flex-row">
232238
<div className="relative border-neu-50 bg-neu-50 dark:bg-neu-0 max-lg:-mx-px max-lg:my-px max-lg:border-x lg:mr-px">
233239
<span className="typography-body-sm mt-3 inline-block w-28 whitespace-nowrap pb-0.5 pl-4 lg:mr-6 lg:pb-4 lg:pl-0">
234-
{formatBlockTime(sessionDate, blockEnd)}
240+
{formatBlockTime(
241+
sessionDate,
242+
endTimesDiffer ? undefined : blockEnd,
243+
)}
235244
</span>
236245
</div>
237246
<div className="relative flex w-full flex-col items-end gap-px lg:flex-row lg:items-start">
@@ -242,6 +251,7 @@ export function ScheduleList({
242251
year={year}
243252
eventsColors={eventsColors}
244253
blockEnd={blockEnd}
254+
durationVisible={endTimesDiffer}
245255
/>
246256
))}
247257
</div>

src/app/conf/2025/schedule/_components/schedule-session-card.tsx

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import ClockIcon from "@/app/conf/_design-system/pixelarticons/clock.svg?svgr"
1919

2020
import { getEventTitle } from "../../utils"
2121
import { CalendarIcon } from "@/app/conf/_design-system/pixelarticons/calendar-icon"
22+
import { formatBlockTime } from "./format-block-time"
2223

2324
function isString(x: unknown): x is string {
2425
return Object.prototype.toString.call(x) === "[object String]"
@@ -29,11 +30,13 @@ export function ScheduleSessionCard({
2930
year,
3031
eventsColors,
3132
blockEnd,
33+
durationVisible,
3234
}: {
3335
session: ScheduleSession
3436
year: `202${number}`
3537
eventsColors: Record<string, string>
3638
blockEnd: Date
39+
durationVisible: boolean
3740
}) {
3841
let eventType = session.event_type
3942

@@ -139,17 +142,7 @@ export function ScheduleSessionCard({
139142
{session.venue}
140143
</span>
141144
)}
142-
{blockTimeFraction < 1 && (
143-
<span className="typography-body-xs flex items-center gap-0.5">
144-
<ClockIcon className="size-4 text-pri-base [@container(width<240px)]:hidden" />
145-
{Math.round(
146-
(new Date(session.event_end).getTime() -
147-
new Date(session.event_start).getTime()) /
148-
(1000 * 60),
149-
)}{" "}
150-
min
151-
</span>
152-
)}
145+
{durationVisible && <SessionDuration session={session} />}
153146
<AddToCalendarLink
154147
eventTitle={eventTitle}
155148
session={session}
@@ -164,6 +157,29 @@ export function ScheduleSessionCard({
164157
)
165158
}
166159

160+
function SessionDuration({
161+
session,
162+
}: {
163+
session: ScheduleSession
164+
}): React.ReactNode {
165+
const durationMs =
166+
new Date(session.event_end).getTime() -
167+
new Date(session.event_start).getTime()
168+
169+
// if a session is longer than 3 hourse, we show the time range
170+
const formattedTime =
171+
durationMs > 1000 * 60 * 60 * 3
172+
? formatBlockTime(session.event_start, new Date(session.event_end))
173+
: `${Math.round(durationMs / (1000 * 60))} min`
174+
175+
return (
176+
<span className="typography-body-xs flex items-center gap-0.5">
177+
<ClockIcon className="size-4 text-pri-base [@container(width<240px)]:hidden" />
178+
{formattedTime}
179+
</span>
180+
)
181+
}
182+
167183
function AddToCalendarLink({
168184
eventTitle,
169185
session,

0 commit comments

Comments
 (0)