Refactors project structure and event rendering
Restructures the project for better maintainability and clarity. Adds a ManagerFactory for dependency injection and reorganizes files. Updates event rendering logic to correctly handle overlapping events using a stack link system. The EventRendererStrategy now correctly processes and renders event overlaps, ensuring proper display. Introduces processing tracking to avoid double rendering. Updates documentation to reflect the new structure and build process. Also implements changes to build output and event system for improved clarity. Fixes #123
This commit is contained in:
parent
72019a3d9a
commit
80ef35c42c
7 changed files with 109 additions and 296 deletions
|
|
@ -7,9 +7,8 @@ import { eventBus } from '../core/EventBus';
|
|||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
import { CalendarEvent } from '../types/CalendarTypes';
|
||||
|
||||
// Import Fuse.js ES module
|
||||
// @ts-ignore - Fuse.js types not available for local file
|
||||
import Fuse from '../../wwwroot/js/lib/fuse.min.mjs';
|
||||
// Import Fuse.js from npm
|
||||
import Fuse from 'fuse.js';
|
||||
|
||||
export class EventFilterManager {
|
||||
private searchInput: HTMLInputElement | null = null;
|
||||
|
|
|
|||
|
|
@ -72,8 +72,16 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
|
|||
return;
|
||||
}
|
||||
|
||||
// Track hvilke events der allerede er blevet processeret
|
||||
const processedEvents = new Set<string>();
|
||||
|
||||
// Gå gennem hvert event og find overlaps
|
||||
events.forEach((currentEvent, index) => {
|
||||
// Skip events der allerede er processeret som del af en overlap gruppe
|
||||
if (processedEvents.has(currentEvent.id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const remainingEvents = events.slice(index + 1);
|
||||
const overlappingEvents = this.overlapDetector.resolveOverlap(currentEvent, remainingEvents);
|
||||
|
||||
|
|
@ -81,10 +89,14 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
|
|||
// Der er overlaps - opret stack links
|
||||
const result = this.overlapDetector.decorateWithStackLinks(currentEvent, overlappingEvents);
|
||||
this.new_renderOverlappingEvents(result, container);
|
||||
|
||||
// Marker alle events i overlap gruppen som processeret
|
||||
overlappingEvents.forEach(event => processedEvents.add(event.id));
|
||||
} else {
|
||||
// Intet overlap - render normalt
|
||||
const element = this.renderEvent(currentEvent);
|
||||
container.appendChild(element);
|
||||
processedEvents.add(currentEvent.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export class OverlapDetector {
|
|||
};
|
||||
stackLinks.set(event.id as EventId, stackLink);
|
||||
});
|
||||
|
||||
overlappingEvents.push(newEvent);
|
||||
return {
|
||||
overlappingEvents,
|
||||
stackLinks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue