diff --git a/src/managers/AllDayManager.ts b/src/managers/AllDayManager.ts index 74e770f..037e1bb 100644 --- a/src/managers/AllDayManager.ts +++ b/src/managers/AllDayManager.ts @@ -569,18 +569,27 @@ export class AllDayManager { let overflowCount = totalEventsInColumn - ALL_DAY_CONSTANTS.MAX_COLLAPSED_ROWS if (overflowCount > 0) { - // Create new overflow indicator element - let overflowElement = document.createElement('swp-event'); - overflowElement.className = 'max-event-indicator'; - overflowElement.style.gridRow = ALL_DAY_CONSTANTS.MAX_COLLAPSED_ROWS.toString(); - overflowElement.style.gridColumn = columnBounds.index.toString(); - overflowElement.innerHTML = `+${overflowCount + 1} more`; - overflowElement.onclick = (e) => { - e.stopPropagation(); - this.toggleExpanded(); - }; + // Check if indicator already exists in this column + let existingIndicator = container.querySelector(`.max-event-indicator[data-column="${columnBounds.index}"]`) as HTMLElement; - container.appendChild(overflowElement); + if (existingIndicator) { + // Update existing indicator + existingIndicator.innerHTML = `+${overflowCount + 1} more`; + } else { + // Create new overflow indicator element + let overflowElement = document.createElement('swp-event'); + overflowElement.className = 'max-event-indicator'; + overflowElement.setAttribute('data-column', columnBounds.index.toString()); + overflowElement.style.gridRow = ALL_DAY_CONSTANTS.MAX_COLLAPSED_ROWS.toString(); + overflowElement.style.gridColumn = columnBounds.index.toString(); + overflowElement.innerHTML = `+${overflowCount + 1} more`; + overflowElement.onclick = (e) => { + e.stopPropagation(); + this.toggleExpanded(); + }; + + container.appendChild(overflowElement); + } } }); } diff --git a/src/renderers/EventRenderer.ts b/src/renderers/EventRenderer.ts index 2ad8833..fd2e5a1 100644 --- a/src/renderers/EventRenderer.ts +++ b/src/renderers/EventRenderer.ts @@ -331,33 +331,6 @@ export abstract class BaseEventRenderer implements EventRendererStrategy { } - /** - * Handle event click (when drag threshold not reached) - */ - public handleEventClick(eventId: string, originalElement: HTMLElement): void { - console.log('handleEventClick:', eventId); - - // Clean up any drag artifacts from failed drag attempt - if (this.draggedClone) { - this.draggedClone.classList.remove('dragging'); - this.draggedClone.remove(); - this.draggedClone = null; - } - - // Restore original element styling if it was modified - if (this.originalEvent) { - this.originalEvent.style.opacity = ''; - this.originalEvent.style.userSelect = ''; - this.originalEvent = null; - } - - // Emit a clean click event for other components to handle - eventBus.emit('event:clicked', { - eventId: eventId, - element: originalElement - }); - } - /** * Handle navigation completed event */ diff --git a/src/renderers/EventRendererManager.ts b/src/renderers/EventRendererManager.ts index b15b254..b7965c4 100644 --- a/src/renderers/EventRendererManager.ts +++ b/src/renderers/EventRendererManager.ts @@ -197,16 +197,6 @@ export class EventRenderingService { } }); - // Handle click (when drag threshold not reached) - this.eventBus.on('event:click', (event: Event) => { - const { draggedElement } = (event as CustomEvent).detail; - // Use draggedElement directly - no need for DOM query - if (draggedElement && this.strategy.handleEventClick) { - const eventId = draggedElement.dataset.eventId || ''; - this.strategy.handleEventClick(eventId, draggedElement); //TODO: fix this redundant parameters - } - }); - // Handle column change this.eventBus.on('drag:column-change', (event: Event) => { let columnChangeEvent = (event as CustomEvent).detail;