Refactors calendar initialization with factory
Implements a factory pattern for manager creation and initialization, improving dependency management and extensibility. This change replaces direct manager instantiation with a `ManagerFactory` that handles dependency injection. This enhances code organization and testability. It also includes an initialization sequence diagram for better understanding of the calendar's architecture and data flow.
This commit is contained in:
parent
32ee35eb02
commit
26f0cb8aaa
11 changed files with 333 additions and 150 deletions
|
|
@ -197,25 +197,12 @@ export class NavigationManager {
|
|||
});
|
||||
}
|
||||
|
||||
// Utility functions (from POC) - moved formatting to NavigationRenderer
|
||||
|
||||
private updateWeekInfo(): void {
|
||||
const weekNumber = DateUtils.getWeekNumber(this.currentWeek);
|
||||
const weekEnd = DateUtils.addDays(this.currentWeek, 6);
|
||||
const dateRange = DateUtils.formatDateRange(this.currentWeek, weekEnd);
|
||||
|
||||
// Update week info in DOM
|
||||
const weekNumberElement = document.querySelector('swp-week-number');
|
||||
const dateRangeElement = document.querySelector('swp-date-range');
|
||||
|
||||
if (weekNumberElement)
|
||||
weekNumberElement.textContent = `Week ${weekNumber}`;
|
||||
|
||||
|
||||
if (dateRangeElement)
|
||||
dateRangeElement.textContent = dateRange;
|
||||
|
||||
// Notify other managers about week info update
|
||||
// Notify other managers about week info update - DOM manipulation should happen via events
|
||||
this.eventBus.emit(EventTypes.WEEK_INFO_UPDATED, {
|
||||
weekNumber,
|
||||
dateRange,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue