Compare commits
3 Commits
570f136ef8
...
d8f9ad9979
Author | SHA1 | Date |
---|---|---|
Vencislav Atanasov | d8f9ad9979 | |
Vencislav Atanasov | 1779210759 | |
Vencislav Atanasov | 67024419e0 |
|
@ -19,7 +19,7 @@ export default function Schedule({
|
||||||
speakers: allSpeakers,
|
speakers: allSpeakers,
|
||||||
tracks: allTracks,
|
tracks: allTracks,
|
||||||
eventTypes,
|
eventTypes,
|
||||||
halls,
|
halls: allHalls,
|
||||||
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,
|
halls: allHalls,
|
||||||
events: allEvents,
|
events: allEvents,
|
||||||
slots,
|
slots,
|
||||||
});
|
});
|
||||||
|
@ -55,9 +55,10 @@ export default function Schedule({
|
||||||
<hr/>
|
<hr/>
|
||||||
{rows.length > 0 && <>
|
{rows.length > 0 && <>
|
||||||
<table>
|
<table>
|
||||||
{header.length > 0 && <thead>
|
{halls.length > 0 && <thead>
|
||||||
<tr>
|
<tr>
|
||||||
{header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
<th />
|
||||||
|
{halls.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>}
|
</thead>}
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -69,9 +70,10 @@ export default function Schedule({
|
||||||
</td>)}
|
</td>)}
|
||||||
</tr>)}
|
</tr>)}
|
||||||
</tbody>
|
</tbody>
|
||||||
{header.length > 0 && <tfoot>
|
{halls.length > 0 && <tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
{header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
<th />
|
||||||
|
{halls.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>}
|
</tfoot>}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
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({
|
||||||
|
@ -27,13 +26,6 @@ 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;
|
||||||
|
@ -126,7 +118,7 @@ export default function useScheduleTable({
|
||||||
cells: [{
|
cells: [{
|
||||||
id: 'header',
|
id: 'header',
|
||||||
attributes: {
|
attributes: {
|
||||||
colSpan: header.length,
|
colSpan: halls.length + 1,
|
||||||
},
|
},
|
||||||
dateHeader: date,
|
dateHeader: date,
|
||||||
}],
|
}],
|
||||||
|
@ -148,9 +140,9 @@ export default function useScheduleTable({
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
header,
|
|
||||||
rows,
|
rows,
|
||||||
tracks,
|
tracks,
|
||||||
|
halls,
|
||||||
events,
|
events,
|
||||||
speakers,
|
speakers,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue