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) { export default function Event(event) {
return (<> return (<>
<a href={'#lecture-'.concat(event.id)}>{event.title}</a> <a href={'#event-'.concat(event.id)}>{event.title}</a>
<br /> <br />
{event.participant_users && !isTrackHidden(event.track) && <> {event.participant_users && !isTrackHidden(event.track) && <>
{event.participant_users.map(speaker => speaker && <Speaker key={speaker.id} {...speaker} />)} {event.participant_users.map(speaker => speaker && <Speaker key={speaker.id} {...speaker} />)}

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import useSWR from 'swr'; 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) { export default function useCfpRequest(path) {
return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher); return useSWR(import.meta.env.VITE_CFP_BASE_URL.concat(path), fetcher);

View File

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

View File

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