Skip to content

Commit e89078b

Browse files
andreas-taranetzjgrumboe
authored andcommitted
Reorder home page section
Fix live page; Adjust to new sessionize data format
1 parent d158141 commit e89078b

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

src/components/pages/home/schedule/schedule.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ const Schedule = () => (
66
<section className="safe-paddings container-md text-center">
77
<h2 id="schedule">Schedule</h2>
88
<p className="text-balance">
9-
See the full schedule and mark talks you're interested in so you won't miss a session.
9+
Check out what is happening right now, or see the full schedule and mark talks you're
10+
interested in so you won't miss a session.
1011
</p>
11-
<Button to={scheduleUrl} className="my-6">
12-
Full schedule
13-
</Button>
12+
<div className="flex flex-row justify-center gap-4 flex-wrap">
13+
<Button to="/live" className="my-6">
14+
Live now
15+
</Button>
16+
<Button to={scheduleUrl} className="my-6">
17+
Full schedule
18+
</Button>
19+
</div>
1420
{/* <div className="flex flex-row flex-wrap justify-around md:flex-col mt-4 gap-y-2">
1521
<div className="w-[32%] md:w-full bg-gray-12 rounded-md p-4 flex-col inline-block justify-center content-start">
1622
<strong className="text-sm bg-orange py-1 px-2 rounded-full">Tuesday, October 8</strong>

src/components/pages/live/current-sessions/current-sessions.jsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React, { useCallback, useEffect, useState } from 'react';
1+
import React from 'react';
22

33
import { getSessionUrl } from '../../../../constants/sessionize-app';
4-
import { loadAllSessions } from '../../../shared/data/loadAllSessions';
5-
import { set } from 'lodash';
4+
import { useLoadAllSessions } from '../../../shared/data/loadAllSessions';
65

76
const getSessionTime = (session) => {
87
const start = new Date(session.startsAt);
@@ -28,13 +27,14 @@ const Session = ({ session }) => {
2827

2928
const SessionsForRoom = ({ roomName, allSessions }) => {
3029
const currentTime = new Date();
31-
const sessionsOfRoom = allSessions.find(s => s.groupName == roomName)?.sessions
30+
const sessionsOfRoom = allSessions
31+
.filter(s => s.room == roomName)
3232
.filter(s => new Date(s.startsAt).getDate() == currentTime.getDate())?? [];
3333
const currentSession = sessionsOfRoom.filter(s => new Date(s.startsAt) <= currentTime)
3434
.filter(s => new Date(s.endsAt) > currentTime)[0];
3535
const nextSession = sessionsOfRoom.find(s => new Date(s.startsAt) > currentTime);
3636

37-
if(sessionsOfRoom.length == 0) return;
37+
if(sessionsOfRoom.length === 0) return <div className="col-span-1"/>;
3838

3939
return (
4040
<div className="col-span-1">
@@ -47,14 +47,12 @@ const SessionsForRoom = ({ roomName, allSessions }) => {
4747
};
4848

4949
const CurrentSessions = () => {
50-
const allSessions = loadAllSessions(30000);
51-
50+
const allSessions = useLoadAllSessions(30000);
5251
if (!allSessions) {
5352
return <p>Loading...</p>
5453
}
5554
const currentDate = new Date().getDate();
56-
const isAnythingScheduledToday = allSessions.flatMap(group => group.sessions)
57-
.some(session => new Date(session.startsAt).getDate() === currentDate);
55+
const isAnythingScheduledToday = allSessions.some(session => new Date(session.startsAt).getDate() === currentDate);
5856

5957
if(!isAnythingScheduledToday) return <p>Nothing scheduled today</p>
6058

src/components/pages/speakers/speakers.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useState } from 'react';
22

3+
import Button from 'components/shared/button/button';
4+
import links from '../../../constants/links';
35
import { loadAllSpeakers, loadKeynoteSpeakers } from '../../shared/data/loadAllSpeakers';
46
import Person from '../../shared/person';
57
import SpeakerModal from '../../shared/speaker/speakerModal';
6-
import Button from 'components/shared/button/button';
7-
import links from '../../../constants/links';
88

99
const Speakers = ({ keynote }) => {
1010
const [selectedSpeaker, setSelectedSpeaker] = useState(null);

src/components/shared/data/loadAllSessions.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { useState, useEffect } from 'react';
22

3-
export const loadAllSessions = (refreshInterval) => {
3+
export const useLoadAllSessions = (refreshInterval) => {
44
const [sessions, setSessions] = useState([]);
55

66
useEffect(() => {
77
const fetchSpeakers = async () => {
88
try {
99
const response = await fetch('https://sessionize.com/api/v2/fetamiym/view/Sessions');
1010
const data = await response.json();
11-
setSessions(data);
11+
setSessions(data.at(0).sessions ?? []);
1212
} catch (error) {
1313
console.error('Error fetching sessions:', error);
1414
}
@@ -24,7 +24,7 @@ export const loadAllSessions = (refreshInterval) => {
2424
return () => {
2525
if (interval) clearInterval(interval);
2626
};
27-
}, []);
27+
}, [refreshInterval]);
2828

2929
return sessions;
3030
};

src/pages/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import Speakers from '../components/pages/speakers/speakers';
1717
const HomePage = () => (
1818
<Layout homepage>
1919
<Hero />
20-
<Tickets />
20+
<Schedule />
2121
{/* <Cfp /> */}
2222
{/* <Info /> */}
2323
<Speakers keynote />
24-
<Schedule />
24+
<Tickets />
2525
<Venue />
2626
<WrapUp />
2727
{/* <Sponsors /> */}

0 commit comments

Comments
 (0)