Compare commits
No commits in common. "d8f9ad99791283f4057f62712d62101e93fb24b4" and "570f136ef8e3c756704615f869e3eb963a9be841" have entirely different histories.
d8f9ad9979
...
570f136ef8
@ -19,7 +19,7 @@ export default function Schedule({
|
|||||||
speakers: allSpeakers,
|
speakers: allSpeakers,
|
||||||
tracks: allTracks,
|
tracks: allTracks,
|
||||||
eventTypes,
|
eventTypes,
|
||||||
halls: allHalls,
|
halls,
|
||||||
events: allEvents,
|
events: allEvents,
|
||||||
slots,
|
slots,
|
||||||
isLoading,
|
isLoading,
|
||||||
@ -30,16 +30,16 @@ export default function Schedule({
|
|||||||
const [eventTypeId, setEventTypeId] = useState(0);
|
const [eventTypeId, setEventTypeId] = useState(0);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
header,
|
||||||
rows,
|
rows,
|
||||||
speakers,
|
speakers,
|
||||||
tracks,
|
tracks,
|
||||||
halls,
|
|
||||||
events,
|
events,
|
||||||
} = useScheduleTable({
|
} = useScheduleTable({
|
||||||
eventTypeId,
|
eventTypeId,
|
||||||
speakers: allSpeakers,
|
speakers: allSpeakers,
|
||||||
tracks: allTracks,
|
tracks: allTracks,
|
||||||
halls: allHalls,
|
halls,
|
||||||
events: allEvents,
|
events: allEvents,
|
||||||
slots,
|
slots,
|
||||||
});
|
});
|
||||||
@ -55,10 +55,9 @@ export default function Schedule({
|
|||||||
<hr/>
|
<hr/>
|
||||||
{rows.length > 0 && <>
|
{rows.length > 0 && <>
|
||||||
<table>
|
<table>
|
||||||
{halls.length > 0 && <thead>
|
{header.length > 0 && <thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th />
|
{header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
||||||
{halls.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>}
|
</thead>}
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -70,10 +69,9 @@ export default function Schedule({
|
|||||||
</td>)}
|
</td>)}
|
||||||
</tr>)}
|
</tr>)}
|
||||||
</tbody>
|
</tbody>
|
||||||
{halls.length > 0 && <tfoot>
|
{header.length > 0 && <tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th />
|
{header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
||||||
{halls.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>}
|
</tfoot>}
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { sorter } from '../utils.js';
|
import { sorter } from '../utils.js';
|
||||||
|
import { langs } from '../Schedule/constants.js';
|
||||||
import { compareAsc, getTime, isSameDay, toDate } from 'date-fns';
|
import { compareAsc, getTime, isSameDay, toDate } from 'date-fns';
|
||||||
|
|
||||||
export default function useScheduleTable({
|
export default function useScheduleTable({
|
||||||
@ -26,6 +27,13 @@ export default function useScheduleTable({
|
|||||||
const halls = allHalls.filter(hall => hallIds.has(hall.id));
|
const halls = allHalls.filter(hall => hallIds.has(hall.id));
|
||||||
const skipHallSlots = new Map();
|
const skipHallSlots = new Map();
|
||||||
|
|
||||||
|
const header = [{
|
||||||
|
id: 0,
|
||||||
|
name: Object.fromEntries(Object.keys(langs).map(lang => [lang, ''])),
|
||||||
|
},
|
||||||
|
...halls,
|
||||||
|
];
|
||||||
|
|
||||||
const rows = microslots.flatMap((date, slotsIndex, slotsArray) => {
|
const rows = microslots.flatMap((date, slotsIndex, slotsArray) => {
|
||||||
const isFirst = slotsIndex === 0;
|
const isFirst = slotsIndex === 0;
|
||||||
const isLast = slotsIndex === slotsArray.length - 1;
|
const isLast = slotsIndex === slotsArray.length - 1;
|
||||||
@ -118,7 +126,7 @@ export default function useScheduleTable({
|
|||||||
cells: [{
|
cells: [{
|
||||||
id: 'header',
|
id: 'header',
|
||||||
attributes: {
|
attributes: {
|
||||||
colSpan: halls.length + 1,
|
colSpan: header.length,
|
||||||
},
|
},
|
||||||
dateHeader: date,
|
dateHeader: date,
|
||||||
}],
|
}],
|
||||||
@ -140,9 +148,9 @@ export default function useScheduleTable({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
header,
|
||||||
rows,
|
rows,
|
||||||
tracks,
|
tracks,
|
||||||
halls,
|
|
||||||
events,
|
events,
|
||||||
speakers,
|
speakers,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user