diff --git a/management-dashboard-web-app/src/components/DashboardLayout.tsx b/management-dashboard-web-app/src/components/DashboardLayout.tsx index af4a5e4..adac4f1 100755 --- a/management-dashboard-web-app/src/components/DashboardLayout.tsx +++ b/management-dashboard-web-app/src/components/DashboardLayout.tsx @@ -249,7 +249,7 @@ export function DashboardLayout({ onLogout, currentRoute }: DashboardLayoutProps ) case 'scheduling': return ( - + Loading scheduling module...}> diff --git a/scheduling-remote/src/components/HorizontalTimelineCalendar.tsx b/scheduling-remote/src/components/HorizontalTimelineCalendar.tsx index e1061ff..aefd77b 100644 --- a/scheduling-remote/src/components/HorizontalTimelineCalendar.tsx +++ b/scheduling-remote/src/components/HorizontalTimelineCalendar.tsx @@ -951,18 +951,23 @@ export function HorizontalTimelineCalendar({ }).filter((d): d is NonNullable => d !== null) // Calculate vertical stacking positions + // Sort by left position to process from left to right const sortedRepetitions = [...repetitionData].sort((a, b) => a.left - b.left) const repetitionRows: Array> = [] sortedRepetitions.forEach(rep => { let placed = false + // Try to place in existing rows first for (let rowIndex = 0; rowIndex < repetitionRows.length; rowIndex++) { const row = repetitionRows[rowIndex] + // Check if this repetition overlaps with ANY repetition in this row const hasOverlap = row.some(existingRep => { - const threshold = 1 - return !(rep.right + threshold <= existingRep.left || rep.left - threshold >= existingRep.right) + // Two repetitions overlap if they share any horizontal space + // Overlap occurs when: rep.left < existingRep.right AND rep.right > existingRep.left + return rep.left < existingRep.right && rep.right > existingRep.left }) + // If no overlap with any repetition in this row, we can place it here if (!hasOverlap) { row.push(rep) placed = true @@ -970,6 +975,7 @@ export function HorizontalTimelineCalendar({ } } + // If couldn't place in any existing row (due to overlaps), create a new row if (!placed) { repetitionRows.push([rep]) }