Remove resource calendar mode support

Simplifies calendar configuration and removes resource-specific code paths

Eliminates complexity around resource-based calendar rendering by:
- Removing ResourceCalendarData type
- Removing resource-specific renderers and managers
- Streamlining event and grid management logic
- Consolidating to single date-based calendar implementation
This commit is contained in:
Janus C. H. Knudsen 2025-11-01 01:10:10 +01:00
parent 349e1e8293
commit cda201301c
16 changed files with 65 additions and 323 deletions

View file

@ -1,5 +1,5 @@
import { CalendarConfig } from '../core/CalendarConfig';
import { ResourceCalendarData, CalendarView } from '../types/CalendarTypes';
import { CalendarView } from '../types/CalendarTypes';
import { ColumnRenderer, ColumnRenderContext } from './ColumnRenderer';
import { eventBus } from '../core/EventBus';
import { DateService } from '../utils/DateService';
@ -30,7 +30,6 @@ export class GridRenderer {
public renderGrid(
grid: HTMLElement,
currentDate: Date,
resourceData: ResourceCalendarData | null,
view: CalendarView = 'week'
): void {
@ -43,12 +42,12 @@ export class GridRenderer {
// Only clear and rebuild if grid is empty (first render)
if (grid.children.length === 0) {
this.createCompleteGridStructure(grid, currentDate, resourceData, view);
this.createCompleteGridStructure(grid, currentDate, view);
// Setup grid-related event listeners on first render
// this.setupGridEventListeners();
} else {
// Optimized update - only refresh dynamic content
this.updateGridContent(grid, currentDate, resourceData, view);
this.updateGridContent(grid, currentDate, view);
}
}
@ -58,7 +57,6 @@ export class GridRenderer {
private createCompleteGridStructure(
grid: HTMLElement,
currentDate: Date,
resourceData: ResourceCalendarData | null,
view: CalendarView
): void {
// Create all elements in memory first for better performance
@ -74,7 +72,7 @@ export class GridRenderer {
fragment.appendChild(timeAxis);
// Create grid container with caching
const gridContainer = this.createOptimizedGridContainer(currentDate, resourceData, view);
const gridContainer = this.createOptimizedGridContainer(currentDate, view);
this.cachedGridContainer = gridContainer;
fragment.appendChild(gridContainer);
@ -105,7 +103,6 @@ export class GridRenderer {
private createOptimizedGridContainer(
currentDate: Date,
resourceData: ResourceCalendarData | null,
view: CalendarView
): HTMLElement {
const gridContainer = document.createElement('swp-grid-container');
@ -124,7 +121,7 @@ export class GridRenderer {
// Create column container
const columnContainer = document.createElement('swp-day-columns');
this.renderColumnContainer(columnContainer, currentDate, resourceData, view);
this.renderColumnContainer(columnContainer, currentDate, view);
timeGrid.appendChild(columnContainer);
scrollableContent.appendChild(timeGrid);
@ -142,13 +139,11 @@ export class GridRenderer {
private renderColumnContainer(
columnContainer: HTMLElement,
currentDate: Date,
resourceData: ResourceCalendarData | null,
view: CalendarView
): void {
const context: ColumnRenderContext = {
currentWeek: currentDate, // ColumnRenderer expects currentWeek property
config: this.config,
resourceData: resourceData
config: this.config
};
this.columnRenderer.render(columnContainer, context);
@ -160,14 +155,13 @@ export class GridRenderer {
private updateGridContent(
grid: HTMLElement,
currentDate: Date,
resourceData: ResourceCalendarData | null,
view: CalendarView
): void {
// Update column container if needed
const columnContainer = grid.querySelector('swp-day-columns');
if (columnContainer) {
columnContainer.innerHTML = '';
this.renderColumnContainer(columnContainer as HTMLElement, currentDate, resourceData, view);
this.renderColumnContainer(columnContainer as HTMLElement, currentDate, view);
}
}
/**
@ -182,8 +176,8 @@ export class GridRenderer {
const weekEnd = this.dateService.addDays(weekStart, 6);
// Use SAME method as initial load - respects workweek and resource settings
const newGrid = this.createOptimizedGridContainer(weekStart, null, 'week');
// Use SAME method as initial load - respects workweek settings
const newGrid = this.createOptimizedGridContainer(weekStart, 'week');
// Position new grid for animation - NO transform here, let Animation API handle it
newGrid.style.position = 'absolute';