From 780a95549b031677be53041b7a01761e838a3878 Mon Sep 17 00:00:00 2001 From: salirezav Date: Wed, 14 Jan 2026 16:41:10 -0500 Subject: [PATCH] Enhance ErrorBoundary and improve repetition placement logic in scheduling components - Updated ErrorBoundary to include auto-retry functionality with configurable retry parameters. - Refined repetition placement logic in HorizontalTimelineCalendar to handle overlaps more accurately, ensuring better visual representation of scheduling data. - Added comments for clarity on sorting and overlap checks within the repetition handling process. --- .../src/components/DashboardLayout.tsx | 2 +- .../src/components/HorizontalTimelineCalendar.tsx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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]) }