Remove top left cell from header array

This commit is contained in:
Vencislav Atanasov 2024-10-05 00:06:09 +03:00
parent 570f136ef8
commit 67024419e0
2 changed files with 3 additions and 10 deletions

View File

@ -57,6 +57,7 @@ export default function Schedule({
<table> <table>
{header.length > 0 && <thead> {header.length > 0 && <thead>
<tr> <tr>
<th />
{header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)} {header.map(hall => <th key={hall.id}>{hall.name[lang]}</th>)}
</tr> </tr>
</thead>} </thead>}

View File

@ -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,7 +140,7 @@ export default function useScheduleTable({
}); });
return { return {
header, header: halls,
rows, rows,
tracks, tracks,
events, events,