Skip to content

Commit

Permalink
Fix overlapping sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGinnivan committed Aug 20, 2024
1 parent 741ceec commit a818948
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions website/app/routes/_layout.agenda.($year).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export default function Agenda() {
</Flex>
))}

{schedule.timeSlots.map((timeSlot) => {
{schedule.timeSlots.map((timeSlot, timeSlotIndex) => {
const startTime12 = DateTime.fromISO(timeSlot.slotStart).toFormat('h:mm a').toLowerCase()
const timeSlotSimple = timeSlot.slotStart.replace(/:/g, '')

Expand All @@ -194,13 +194,18 @@ export default function Agenda() {
? DateTime.fromISO(fullSession.endsAt).toFormat('h:mm a').toLowerCase()
: undefined

const nextTimeSlot = schedule.timeSlots[timeSlotIndex + 1]
const nextTimeSlotEnd = nextTimeSlot?.slotStart.replace(/:/g, '')
const timeSlotEnd = endsAtTime?.replace(/:/g, '') ?? ''
const earliestEnd = timeSlotEnd > nextTimeSlotEnd ? nextTimeSlotEnd : timeSlotEnd

return (
<styled.div
key={room.id}
marginBottom="0"
md={{ marginBottom: 1 }}
style={{
gridRow: `time-${timeSlotSimple} / time-${endsAtTime?.replace(/:/g, '')}`,
gridRow: `time-${timeSlotSimple} / time-${earliestEnd}`,
gridColumn:
timeSlot.rooms.length === 1
? `room-${schedule.rooms.at(0)?.id} / room-${schedule.rooms.at(-1)?.id}`
Expand Down

0 comments on commit a818948

Please sign in to comment.