Refactor workweek presets into dedicated manager

Extracts workweek preset logic from ViewManager into WorkweekPresetsManager

Improves separation of concerns by:
- Creating a dedicated manager for workweek preset UI
- Simplifying ViewManager to focus only on view selector
- Implementing event-driven CSS updates
- Reducing code duplication in ConfigManager

Follows "each UI element has its own manager" architectural principle
This commit is contained in:
Janus C. H. Knudsen 2025-11-07 21:50:07 +01:00
parent c72ab9aaf1
commit c1e0da056c
8 changed files with 988 additions and 68 deletions

View file

@ -18,7 +18,7 @@ export const ALL_DAY_CONSTANTS = {
} as const;
/**
* Work week presets
* Work week presets - Configuration data
*/
export const WORK_WEEK_PRESETS: { [key: string]: IWorkWeekSettings } = {
'standard': {
@ -98,22 +98,13 @@ export class Configuration {
return Configuration._instance;
}
// Helper methods
getWorkWeekSettings(): IWorkWeekSettings {
return WORK_WEEK_PRESETS[this.currentWorkWeek] || WORK_WEEK_PRESETS['standard'];
}
setWorkWeek(workWeekId: string): void {
if (WORK_WEEK_PRESETS[workWeekId]) {
this.currentWorkWeek = workWeekId;
this.dateViewSettings.weekDays = WORK_WEEK_PRESETS[workWeekId].totalDays;
}
}
setSelectedDate(date: Date): void {
this.selectedDate = date;
}
getWorkWeekSettings(): IWorkWeekSettings {
return WORK_WEEK_PRESETS[this.currentWorkWeek] || WORK_WEEK_PRESETS['standard'];
}
}
// Backward compatibility alias