WIP: integrate-old-refactors-of-github #1
@@ -249,7 +249,7 @@ export function DashboardLayout({ onLogout, currentRoute }: DashboardLayoutProps
|
|||||||
)
|
)
|
||||||
case 'scheduling':
|
case 'scheduling':
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary>
|
<ErrorBoundary autoRetry={true} retryDelay={2000} maxRetries={3}>
|
||||||
<Suspense fallback={<div className="p-6">Loading scheduling module...</div>}>
|
<Suspense fallback={<div className="p-6">Loading scheduling module...</div>}>
|
||||||
<RemoteScheduling user={user} currentRoute={currentRoute} />
|
<RemoteScheduling user={user} currentRoute={currentRoute} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
@@ -951,18 +951,23 @@ export function HorizontalTimelineCalendar({
|
|||||||
}).filter((d): d is NonNullable<typeof d> => d !== null)
|
}).filter((d): d is NonNullable<typeof d> => d !== null)
|
||||||
|
|
||||||
// Calculate vertical stacking positions
|
// 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 sortedRepetitions = [...repetitionData].sort((a, b) => a.left - b.left)
|
||||||
const repetitionRows: Array<Array<typeof repetitionData[0]>> = []
|
const repetitionRows: Array<Array<typeof repetitionData[0]>> = []
|
||||||
|
|
||||||
sortedRepetitions.forEach(rep => {
|
sortedRepetitions.forEach(rep => {
|
||||||
let placed = false
|
let placed = false
|
||||||
|
// Try to place in existing rows first
|
||||||
for (let rowIndex = 0; rowIndex < repetitionRows.length; rowIndex++) {
|
for (let rowIndex = 0; rowIndex < repetitionRows.length; rowIndex++) {
|
||||||
const row = repetitionRows[rowIndex]
|
const row = repetitionRows[rowIndex]
|
||||||
|
// Check if this repetition overlaps with ANY repetition in this row
|
||||||
const hasOverlap = row.some(existingRep => {
|
const hasOverlap = row.some(existingRep => {
|
||||||
const threshold = 1
|
// Two repetitions overlap if they share any horizontal space
|
||||||
return !(rep.right + threshold <= existingRep.left || rep.left - threshold >= existingRep.right)
|
// 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) {
|
if (!hasOverlap) {
|
||||||
row.push(rep)
|
row.push(rep)
|
||||||
placed = true
|
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) {
|
if (!placed) {
|
||||||
repetitionRows.push([rep])
|
repetitionRows.push([rep])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user