Refactors calendar configuration and event handling
Streamlines calendar configuration by adopting a singleton pattern for consistent access and simplifies event handling.
- Removes direct `CalendarConfig` dependency injection in favor of the `calendarConfig` singleton, reducing code complexity.
- Replaces specific event emissions for grid, date, and resource settings updates with a general `REFRESH_REQUESTED` event.
- Updates event names to be more descriptive and consistent ("NAVIGATION_COMPLETED", "PERIOD_INFO_UPDATE").
- Removes the need to pass the calendar config to renderers since it is now a singleton.
This improves code maintainability and simplifies the event emission process.
This commit is contained in:
parent
d0936d1838
commit
2083c6921e
19 changed files with 139 additions and 173 deletions
|
|
@ -25,7 +25,7 @@ export class NavigationManager {
|
|||
this.eventBus = eventBus;
|
||||
DateCalculator.initialize(calendarConfig);
|
||||
this.dateCalculator = new DateCalculator();
|
||||
this.navigationRenderer = new NavigationRenderer(eventBus, calendarConfig, eventRenderer);
|
||||
this.navigationRenderer = new NavigationRenderer(eventBus, eventRenderer);
|
||||
this.currentWeek = DateCalculator.getISOWeekStart(new Date());
|
||||
this.targetWeek = new Date(this.currentWeek);
|
||||
this.init();
|
||||
|
|
@ -239,7 +239,7 @@ export class NavigationManager {
|
|||
this.updateWeekInfo();
|
||||
|
||||
// Emit period change event for ScrollManager
|
||||
this.eventBus.emit(CoreEvents.PERIOD_CHANGED, {
|
||||
this.eventBus.emit(CoreEvents.NAVIGATION_COMPLETED, {
|
||||
direction,
|
||||
weekStart: this.currentWeek
|
||||
});
|
||||
|
|
@ -253,7 +253,7 @@ export class NavigationManager {
|
|||
const dateRange = DateCalculator.formatDateRange(this.currentWeek, weekEnd);
|
||||
|
||||
// Notify other managers about week info update - DOM manipulation should happen via events
|
||||
this.eventBus.emit(CoreEvents.WEEK_CHANGED, {
|
||||
this.eventBus.emit(CoreEvents.PERIOD_INFO_UPDATE, {
|
||||
weekNumber,
|
||||
dateRange,
|
||||
weekStart: this.currentWeek,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue