Calculates all-day event container height correctly

Improves the calculation of the all-day event container's
height by finding the highest row number in use, ensuring
the container accurately reflects the space occupied by events.

Updates debug logging for clarity.
This commit is contained in:
Janus C. H. Knudsen 2025-09-25 18:17:37 +02:00
parent 1e20e23e77
commit 4daf1f6975

View file

@ -178,20 +178,20 @@ export class AllDayManager {
let maxRows = 0;
if (allDayEvents.length > 0) {
// Track which rows are actually used by checking grid positions
const usedRows = new Set<number>();
// Find the HIGHEST row number in use (not count of unique rows)
let highestRow = 0;
(Array.from(allDayEvents) as HTMLElement[]).forEach((event: HTMLElement) => {
const gridRow = parseInt(getComputedStyle(event).gridRowStart) || 1;
usedRows.add(gridRow);
highestRow = Math.max(highestRow, gridRow);
});
// Max rows = highest row number in use
maxRows = usedRows.size > 0 ? Math.max(...usedRows) : 0;
// Max rows = highest row number (e.g. if row 3 is used, height = 3 rows)
maxRows = highestRow;
console.log('🔍 AllDayManager: Height calculation', {
console.log('🔍 AllDayManager: Height calculation FIXED', {
totalEvents: allDayEvents.length,
usedRows: Array.from(usedRows).sort(),
highestRowFound: highestRow,
maxRows
});
}