Major refactor into type safe TS

With a risk oof rolling it all back
This commit is contained in:
Janus C. H. Knudsen 2025-09-23 20:44:15 +02:00
parent c08fa02c29
commit 48d1fd681c
19 changed files with 449 additions and 81 deletions

View file

@ -1,6 +1,16 @@
import { calendarConfig } from '../core/CalendarConfig';
import { ResourceCalendarData } from '../types/CalendarTypes';
interface GridSettings {
hourHeight: number;
snapInterval: number;
dayStartHour: number;
dayEndHour: number;
workStartHour: number;
workEndHour: number;
fitToWidth?: boolean;
}
/**
* GridStyleManager - Manages CSS variables and styling for the grid
* Separated from GridManager to follow Single Responsibility Principle
@ -38,7 +48,7 @@ export class GridStyleManager {
/**
* Set time-related CSS variables
*/
private setTimeVariables(root: HTMLElement, gridSettings: any): void {
private setTimeVariables(root: HTMLElement, gridSettings: GridSettings): void {
root.style.setProperty('--hour-height', `${gridSettings.hourHeight}px`);
root.style.setProperty('--minute-height', `${gridSettings.hourHeight / 60}px`);
root.style.setProperty('--snap-interval', gridSettings.snapInterval.toString());
@ -76,7 +86,7 @@ export class GridStyleManager {
/**
* Set column width based on fitToWidth setting
*/
private setColumnWidth(root: HTMLElement, gridSettings: any): void {
private setColumnWidth(root: HTMLElement, gridSettings: GridSettings): void {
if (gridSettings.fitToWidth) {
root.style.setProperty('--day-column-min-width', '50px'); // Small min-width allows columns to fit available space
} else {