Skip to content

Commit

Permalink
Attempt to fix hydration error for Safari (#213)
Browse files Browse the repository at this point in the history
* attempted fix

* date change

* revert date, use client in windowWidth

* nested p removal

* useEffect fix

* date changes
  • Loading branch information
Bl20052005 authored Nov 2, 2024
1 parent 506390f commit 131f11f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions apps/site/src/app/schedule/Assets/Circle.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
.title {
text-align: center;
width: 200px;
font-weight: bold;
}

.time {
Expand Down
4 changes: 2 additions & 2 deletions apps/site/src/app/schedule/Assets/Circle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const EventCircle: React.FC<CircleProps> = ({
></div>
)}
<div className={styles.textContainer} style={up ? { top: "-160px" } : {}}>
<h5 className={styles.title}>{title}</h5>
<p className={styles.title}>{title}</p>
<p className={styles.location}>{location}</p>
<p className={styles.time}>{convertTime(startTime, endTime)}</p>
{virtual && (
Expand All @@ -69,7 +69,7 @@ const EventCircle: React.FC<CircleProps> = ({
target="_blank"
rel="noopener noreferrer"
>
<p>Zoom</p>
<div>Zoom</div>
<Image src={openNewWindow} alt="open" />
</a>
)}
Expand Down
1 change: 1 addition & 0 deletions apps/site/src/app/schedule/DayOne/DayOne.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
top: -70px;
left: 50%;
transform: translateX(-50%);
font-weight: bold;
}

.mapPath {
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/app/schedule/DayOne/DayOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const DayOne: React.FC<DayOneProps> = ({ schedule, time }) => {
virtual={event?.virtual}
/>
))}
<h4 className={styles.title}>Day One</h4>
<p className={styles.title}>Day One</p>
</div>
</div>
</>
Expand Down
1 change: 1 addition & 0 deletions apps/site/src/app/schedule/DayThree/DayThree.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
top: -250px;
left: 50%;
transform: translateX(-50%);
font-weight: bold;
}

.mapPath {
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/app/schedule/DayThree/DayThree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const DayThree: React.FC<DayThreeProps> = ({ schedule, time }) => {
virtual={event?.virtual}
/>
))}
<h4 className={styles.title}>Day Three</h4>
<p className={styles.title}>Day Three</p>
</div>
</div>
</>
Expand Down
1 change: 1 addition & 0 deletions apps/site/src/app/schedule/DayTwo/DayTwo.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
top: -60px;
left: 50%;
transform: translateX(-50%);
font-weight: bold;
}

.mapPath {
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/app/schedule/DayTwo/DayTwo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const DayTwo: React.FC<DayTwoProps> = ({ schedule, time }) => {
virtual={event?.virtual}
/>
))}
<h4 className={styles.title}>Day Two</h4>
<p className={styles.title}>Day Two</p>
</div>
</div>
</>
Expand Down
18 changes: 12 additions & 6 deletions apps/site/src/app/schedule/ScheduleTimer/ScheduleTimer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,27 @@ const ScheduleTimer: React.FC<ScheduleProps> = ({ schedule }) => {
let ret = setInterval(updatePerSecond, 1000);

return () => clearInterval(ret);
});
}, []);

const scheduleFlat = schedule.flat();
const dayOne = scheduleFlat.filter(
(s) => s.startTime.getTime() < new Date("2024-11-2"),
(s) =>
s.startTime.getTime() <
new Date(new Date("2024-11-02T00:00:00").toUTCString()).getTime(),
);
const dayTwo = scheduleFlat.filter(
(s) =>
s.startTime.getTime() < new Date("2024-11-3") &&
s.startTime.getTime() > new Date("2024-11-2"),
s.startTime.getTime() <
new Date(new Date("2024-11-03T00:00:00").toUTCString()).getTime() &&
s.startTime.getTime() >
new Date(new Date("2024-11-02T00:00:00").toUTCString()).getTime(),
);
const dayThree = scheduleFlat.filter(
(s) =>
s.startTime.getTime() < new Date("2024-11-4") &&
s.startTime.getTime() > new Date("2024-11-3"),
s.startTime.getTime() <
new Date(new Date("2024-11-04T00:00:00").toUTCString()).getTime() &&
s.startTime.getTime() >
new Date(new Date("2024-11-03T00:00:00").toUTCString()).getTime(),
);

return (
Expand Down
2 changes: 2 additions & 0 deletions apps/site/src/lib/useWindowWidth.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useState, useEffect } from "react";

export default function useWindowWidth() {
Expand Down

0 comments on commit 131f11f

Please sign in to comment.