Skip to content

Commit 0e5e136

Browse files
committed
sticky rooms
1 parent 674ae9a commit 0e5e136

File tree

4 files changed

+69
-30
lines changed

4 files changed

+69
-30
lines changed

src/components/molecules/EventDisplay/EventDisplay.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from "react";
2+
import { format } from "date-fns";
23

34
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
45
import { faBookmark as solidBookmark } from "@fortawesome/free-solid-svg-icons";
@@ -31,16 +32,21 @@ export const EventDisplay: React.FC<EventDisplayProps> = ({ event, venue }) => {
3132
});
3233

3334
const starHour = formatHour(event.start_utc_seconds);
35+
const oneHourBehind = format(
36+
new Date().setHours(new Date().getHours() - 1),
37+
"HH"
38+
);
3439
const duration = Math.floor(event.duration_minutes / 60);
40+
const beginnigToShow = Number(starHour) - Number(oneHourBehind);
3541

3642
return (
3743
<div
3844
className={containerClasses}
3945
style={{
40-
marginLeft: `${Number(starHour) * 200 + 280}px`,
46+
marginLeft: `${beginnigToShow * 200 + 52}px`,
4147
width: `${
42-
Number(starHour) * 200 + 100 + duration * 200 > 4800
43-
? 4800 - (Number(starHour) * 200 + 100)
48+
beginnigToShow * 200 + 100 + duration * 200 > 4800
49+
? 4800 - (Number(beginnigToShow) * 200 + 100)
4450
: duration * 200
4551
}px`,
4652
}}

src/components/molecules/EventRoomDisplay/EventRoomDisplay.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export const EventRoomDisplay: React.FC<EventRoomDisplayProps> = ({
3838
[events, venue]
3939
);
4040

41+
if (events?.length === 0) {
42+
return <></>;
43+
}
44+
4145
return (
4246
<div
4347
className={"schedule-time-line"}

src/components/molecules/NavBar/NavBar.scss

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ $border-radius: 28px;
319319
}
320320

321321
.partyinfo-container {
322+
position: sticky;
323+
left: 0;
322324
flex: 1;
323325
margin-right: 60px;
324326
padding: 0 40px 0;
@@ -363,15 +365,15 @@ $border-radius: 28px;
363365
.schedule-time-container {
364366
display: flex;
365367
flex-direction: row;
366-
width: 4800px;
368+
// width: 4800px;
367369
position: absolute;
368-
height: 800px;
370+
height: 100%;
369371
}
370372

371373
.current-time-line {
372374
position: absolute;
373375
width: 1px;
374-
height: 760px;
376+
height: calc(100% - 40px);
375377
margin-top: 40px;
376378
background-color: $primary;
377379
}
@@ -380,26 +382,28 @@ $border-radius: 28px;
380382
flex: 2;
381383
.schedule-tabs {
382384
height: 50px;
383-
padding: 0 40px 0;
384385
}
385386

386387
.schedule-time-line {
387388
display: flex;
388389
position: relative;
389390
flex-direction: row;
390-
width: 4800px;
391+
// width: 4800px;
391392
padding: 0 20px 0;
392393
}
393394
.shcedule-time-line-room {
394395
display: flex;
395396
flex-direction: column;
396-
width: 5%;
397-
margin-top: 30px;
397+
width: 15%;
398+
padding-top: 30px;
398399
box-shadow: 10px 0 30px rgb(0 0 0 / 50%);
400+
z-index: 5;
401+
background-color: black;
402+
position: sticky;
403+
left: 30px;
399404
}
400405

401406
.schedule-event-row {
402-
width: 4800px;
403407
display: flex;
404408
flex-direction: row;
405409
position: relative;
@@ -409,7 +413,7 @@ $border-radius: 28px;
409413
display: flex;
410414
flex-direction: column;
411415
height: calc(100% - 70px);
412-
width: 95%;
416+
width: 85%;
413417
margin-left: 200px;
414418
padding-bottom: 40px;
415419
overflow-y: scroll;
@@ -562,7 +566,7 @@ $border-radius: 28px;
562566
box-shadow: 0 5px 10px rgb(0 0 0 / 65%);
563567

564568
&:hover {
565-
z-index: 1000;
569+
z-index: 2;
566570
}
567571

568572
&.schedule-event-container--live {

src/components/organisms/SchedulePageModal/SchedulePageModal.tsx

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ export const SchedulePageModal: FC<SchedulePageModalProps> = ({
126126
)),
127127
[date, orderedEvents, currentVenue]
128128
);
129+
130+
const roomsWithEvents = useMemo(() => {
131+
let counter = 0;
132+
133+
orderedEvents[date]?.rooms.map((room, index) => {
134+
if (room.events?.length !== 0) {
135+
counter++;
136+
}
137+
});
138+
return counter;
139+
}, [date, orderedEvents]);
140+
129141
const hasEvents = !!orderedEvents?.[date]?.events.length;
130142

131143
// TODO: this was essentially used in the old logic, but the styles look
@@ -148,11 +160,11 @@ export const SchedulePageModal: FC<SchedulePageModalProps> = ({
148160
const descriptionText = hasParentVenue
149161
? parentVenue?.config?.landingPageConfig.description
150162
: currentVenue?.config?.landingPageConfig.description;
151-
const result = getMinutes(getCurrentTimeInUTCSeconds());
163+
const currentMinutes = getMinutes(getCurrentTimeInUTCSeconds()) - 60;
152164

153165
const hours = hoursOfTheDay(
154166
eachHourOfInterval({
155-
start: startOfDay(new Date()),
167+
start: new Date().setHours(new Date().getHours() - 1),
156168
end: endOfDay(new Date()),
157169
})
158170
);
@@ -179,27 +191,40 @@ export const SchedulePageModal: FC<SchedulePageModalProps> = ({
179191
<div className="partyinfo-desc">
180192
<p>{descriptionText}</p>
181193
</div>
194+
<div className="schedule-container">
195+
<ul className="schedule-tabs">{scheduleTabs}</ul>
196+
</div>
182197
</div>
183198

184199
<div className="schedule-container">
185-
<ul className="schedule-tabs">{scheduleTabs}</ul>
200+
{hasEvents && (
201+
<div className="schedule-event-line">
202+
<div className="schedule-time-line-container">
203+
<div
204+
className="schedule-time-container"
205+
style={{
206+
height: `${roomsWithEvents * 160}px`,
207+
}}
208+
>
209+
{dailyHours}
210+
</div>
211+
<div
212+
className="current-time-line"
213+
style={{
214+
left: `${currentMinutes * 0.3 + 390}px`,
215+
height: `${roomsWithEvents * 160 - 40}px`,
216+
}}
217+
></div>
218+
</div>
219+
{eventRooms}
220+
</div>
221+
)}
186222

187-
<div className="schedule-event-line">
223+
{!hasEvents && (
188224
<div className="schedule-time-line-container">
189-
<div className="schedule-time-container">{dailyHours}</div>
190-
<div
191-
className="current-time-line"
192-
style={{
193-
left: `${result * 3.45 + 200}px`,
194-
}}
195-
></div>
196-
{!hasEvents && (
197-
<div>There are no events scheduled for this day.</div>
198-
)}
225+
<div>There are no events scheduled for this day.</div>
199226
</div>
200-
{eventRooms}
201-
</div>
202-
227+
)}
203228
{/* <div className="schedule-time-line">
204229
<div className="shcedule-time-line-room">{eventRooms}</div>
205230

0 commit comments

Comments
 (0)