Misc fixes

This commit is contained in:
Vencislav Atanasov 2024-09-22 16:05:04 +03:00
parent 59cc49db3d
commit 0447f0d85a
6 changed files with 18 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import FeedbackLink from './FeedbackLink.jsx';
export default function Event(event) {
return (<>
<a href={'#lecture-'.concat(event.id)}>{event.title}</a>
<a href={'#event-'.concat(event.id)}>{event.title}</a>
<br />
{event.participant_users && !isTrackHidden(event.track) && <>
{event.participant_users.map(speaker => speaker && <Speaker key={speaker.id} {...speaker} />)}

View File

@ -62,18 +62,18 @@ export default function Schedule({
<div className="separator"/>
<table>
<tbody>
{Object.entries(tracks).filter(([, track]) =>
{Object.values(tracks).filter(track =>
!isTrackHidden(track)
).map(([trackId, track]) => <tr key={trackId}>
).map(track => <tr key={track.id}>
<td className={track.css_class}>{track.name[lang]}</td>
</tr>)}
{Object.entries(langs).map(([code, name]) => <tr key={code}>
<td className={'schedule-'.concat(code)}>{name}</td>
{Object.entries(langs).map(([langId, langName]) => <tr key={langId}>
<td className={'schedule-'.concat(langId)}>{langName}</td>
</tr>)}
</tbody>
</table>
<div className="separator" />
{Object.entries(events).map(([eventId, event]) => <section key={eventId} id={'lecture-'.concat(eventId)}>
{Object.values(events).map(event => <section key={event.id} id={'event-'.concat(event.id)}>
<p>
<strong>{event.title}</strong>
{event.participant_users && !isTrackHidden(event.track) && <>
@ -92,14 +92,14 @@ export default function Schedule({
</section>)}
{<>
<div className="grid members">
{Object.entries(speakers).map(([speakerId, speaker]) => <div key={speakerId} className="col4 wmember">
<a href={'#'.concat(getSpeakerName(speaker))}>
{Object.values(speakers).map(speaker => <div key={speaker.id} className="col4 wmember">
<a href={'#'.concat(speaker.id)}>
<img width="100" height="100" src={defaultSpeaker} alt={getSpeakerName(speaker)} />
</a>
</div>)}
</div>
{Object.entries(speakers).map(([speakerId, speaker]) => <Fragment key={speakerId}>
<div className="speaker" id={getSpeakerName(speaker)}>
{Object.values(speakers).map(speaker => <Fragment key={speaker.id}>
<div className="speaker" id={'speaker-'.concat(speaker.id)}>
<img width="100" height="100" src={defaultSpeaker} alt={getSpeakerName(speaker)}/>
<h3>{getSpeakerName(speaker)}</h3>
<div className="icons">

View File

@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
export default function Speaker(speaker) {
return (<>
<a href={'#'.concat(getSpeakerName(speaker))}>{getSpeakerName(speaker)}</a>
<a href={'#speaker-'.concat(speaker.id.toString())}>{getSpeakerName(speaker)}</a>
{speaker.organisation && <>/&#8288;{speaker.organisation}&#8288;/</>}
</>);
}
Speaker.propTypes = {
id: PropTypes.number.isRequired,
first_name: PropTypes.string.isRequired,
last_name: PropTypes.string.isRequired,
organisation: PropTypes.string,

View File

@ -1,6 +1,6 @@
import useSWR from 'swr';
const fetcher = (...args) => fetch(...args).then(res => res.json());
const fetcher = (input, init) => fetch(input, init).then(res => res.json());
export default function useCfpRequest(path) {
return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher);

View File

@ -3,14 +3,13 @@ export default function useScheduleTable({
halls = {},
lang,
}) {
const hallIds = new Set(Object.keys(halls));
const header = Object.entries(halls).filter(([id]) => hallIds.has(id)).map(([id, hall]) => ({
id,
const header = Object.values(halls).map(hall => ({
id: hall.id,
name: hall.name[lang],
}));
const rows = Object.entries(events).map(([eventId, event]) => ({
id: eventId,
const rows = Object.values(events).map(event => ({
id: event.id,
cells: [{
id: 1,
attributes: {

View File

@ -45,7 +45,7 @@ export function calculateProgress(...elements) {
export const addIdAndRelations = (items, relations = []) =>
Object.fromEntries(Object.entries(items).map(([id, item]) =>
([id, {
id,
id: parseInt(id, 10),
...item,
...Object.fromEntries(relations.map(([field, collection, idField]) => ([
field,