diff --git a/src/Schedule.jsx b/src/Schedule.jsx
index 4a50528..1cc73f9 100644
--- a/src/Schedule.jsx
+++ b/src/Schedule.jsx
@@ -1,49 +1,64 @@
import PropTypes from 'prop-types';
import useSchedule from './hooks/useSchedule.js';
+import { getSpeakerName, isTrackHidden } from './utils.js';
+import { Fragment } from 'react';
export default function Schedule({
conferenceId,
+ lang,
}) {
const {
events,
speakers,
tracks,
- eventTypes,
- halls,
- slots,
isLoading,
} = useSchedule(conferenceId);
return (<>
-
conference id: {conferenceId}
{isLoading && Loading...
}
- {events && <>
- events:
- {JSON.stringify(events)}
- >}
+ schedule goes here
+ {tracks && Object.entries(tracks).map(([trackId, track]) => {track.name[lang]}
+
)}
+ {events && Object.entries(events).map(([eventId, event]) =>
+
+ {event.title}
+ {event.participant_user_ids && !isTrackHidden(tracks[event.track_id]) && speakers && <>
+ ({event.participant_user_ids.map(speakerId => speakers[speakerId] &&
+
+ {getSpeakerName(speakers[speakerId])}
+
+ {speakers[speakerId].organisation && <>
+ /{speakers[speakerId].organisation}/
+ >}
+ ).filter(item => !!item)})
+ >}
+
+ {event.abstract &&
+ {event.abstract}
+
}
+
+
+ Submit feedback
+
+
+
+ )}
{speakers && <>
speakers:
{JSON.stringify(speakers)}
>}
- {tracks && <>
- tracks:
- {JSON.stringify(tracks)}
- >}
- {eventTypes && <>
- event types:
- {JSON.stringify(eventTypes)}
- >}
- {halls && <>
- halls:
- {JSON.stringify(halls)}
- >}
- {slots && <>
- slots:
- {JSON.stringify(slots)}
- >}
>);
}
Schedule.propTypes = {
conferenceId: PropTypes.string.isRequired,
+ lang: PropTypes.string.isRequired,
};
diff --git a/src/ScheduleLoader.jsx b/src/ScheduleLoader.jsx
index 58aad14..165bbda 100644
--- a/src/ScheduleLoader.jsx
+++ b/src/ScheduleLoader.jsx
@@ -2,6 +2,7 @@ import useConferences from './hooks/useConferences.js';
import { useMemo, useState } from 'react';
import Schedule from './Schedule.jsx';
import { dateSorter } from './utils.js';
+import { langs } from './constants.js';
export default function ScheduleLoader() {
const {
@@ -13,8 +14,14 @@ export default function ScheduleLoader() {
const conferences = useMemo(() => Array.isArray(data) ? data.sort(dateSorter('start_date')) : data, [data]);
const [ conferenceId, setConferenceId ] = useState();
+ const [ lang, setLang ] = useState();
return (<>
+
+
+
{isLoading && Please wait...
}
{error && Error: {error}
}
{conferences && <>
@@ -24,8 +31,6 @@ export default function ScheduleLoader() {
value={conference.id}>{conference.title})}
>}
- {conferenceId &&
-
-
}
+ {conferenceId && }
>);
}
diff --git a/src/constants.js b/src/constants.js
new file mode 100644
index 0000000..2358bd6
--- /dev/null
+++ b/src/constants.js
@@ -0,0 +1,4 @@
+export const langs = {
+ en: 'English',
+ bg: 'Български',
+};
diff --git a/src/utils.js b/src/utils.js
index c384d26..ca4b539 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -8,3 +8,7 @@ function sorter(a, b, fieldFn) {
}
export const dateSorter = key => (a, b) => sorter(a, b, item => Date.parse(item[key]));
+
+export const getSpeakerName = speaker => speaker.first_name.concat(' ').concat(speaker.last_name);
+
+export const isTrackHidden = track => track.name.en === 'Other' || track.name.bg === 'Други';