Remove lang from schedule table hook, reorder items

This commit is contained in:
Vencislav Atanasov 2024-09-23 17:13:34 +03:00
parent 8121f3fc30
commit b17572da4b
3 changed files with 6 additions and 11 deletions

View File

@ -15,10 +15,10 @@ export default function Schedule({
lang, lang,
}) { }) {
const { const {
events,
speakers, speakers,
tracks, tracks,
halls, halls,
events,
slots, slots,
isLoading, isLoading,
loadingProgress, loadingProgress,
@ -29,11 +29,10 @@ export default function Schedule({
header, header,
rows, rows,
} = useScheduleTable({ } = useScheduleTable({
events,
tracks, tracks,
halls, halls,
events,
slots, slots,
lang,
}); });
return (<> return (<>
@ -43,7 +42,7 @@ export default function Schedule({
<table> <table>
<thead> <thead>
<tr> <tr>
{header.map(hall => <th key={hall.id}>{hall.name}</th>)} {header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -55,7 +54,7 @@ export default function Schedule({
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
{header.map(hall => <th key={hall.id}>{hall.name}</th>)} {header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -78,11 +78,11 @@ export default function useSchedule(conferenceId) {
} = calculateProgress(events, speakers, tracks, eventTypes, halls, slots); } = calculateProgress(events, speakers, tracks, eventTypes, halls, slots);
return { return {
events,
speakers, speakers,
tracks, tracks,
eventTypes, eventTypes,
halls, halls,
events,
slots, slots,
isLoading, isLoading,
loadingProgress, loadingProgress,

View File

@ -1,12 +1,8 @@
export default function useScheduleTable({ export default function useScheduleTable({
events = {}, events = {},
halls = {}, halls = {},
lang,
}) { }) {
const header = Object.values(halls).map(hall => ({ const header = Object.values(halls);
id: hall.id,
name: hall.name[lang],
}));
const rows = Object.values(events).map(event => ({ const rows = Object.values(events).map(event => ({
id: event.id, id: event.id,