Moving away from Azure Devops #1
4 changed files with 28 additions and 24 deletions
|
|
@ -67,13 +67,5 @@ export const CoreEvents = {
|
|||
AUDIT_LOGGED: 'audit:logged',
|
||||
|
||||
// Rendering events
|
||||
EVENTS_RENDERED: 'events:rendered',
|
||||
|
||||
// Calendar command events
|
||||
CALENDAR_CMD_NAVIGATE_PREV: 'calendar:cmd:navigate:prev',
|
||||
CALENDAR_CMD_NAVIGATE_NEXT: 'calendar:cmd:navigate:next',
|
||||
CALENDAR_CMD_DRAWER_TOGGLE: 'calendar:cmd:drawer:toggle',
|
||||
CALENDAR_CMD_RENDER: 'calendar:cmd:render',
|
||||
CALENDAR_CMD_WORKWEEK_CHANGE: 'calendar:cmd:workweek:change',
|
||||
CALENDAR_CMD_VIEW_UPDATE: 'calendar:cmd:view:update'
|
||||
EVENTS_RENDERED: 'events:rendered'
|
||||
} as const;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { ResourceService } from '../storage/resources/ResourceService';
|
|||
import { ViewConfigService } from '../storage/viewconfigs/ViewConfigService';
|
||||
import { IWorkweekPreset } from '../types/SettingsTypes';
|
||||
import { IEventBus } from '../types/CalendarTypes';
|
||||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
import { CalendarEvents } from './CalendarEvents';
|
||||
|
||||
export class CalendarApp {
|
||||
private animator!: NavigationAnimator;
|
||||
|
|
@ -79,33 +79,33 @@ export class CalendarApp {
|
|||
|
||||
private setupEventListeners(): void {
|
||||
// Navigation commands via EventBus
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_NAVIGATE_PREV, () => {
|
||||
this.eventBus.on(CalendarEvents.CMD_NAVIGATE_PREV, () => {
|
||||
this.handleNavigatePrev();
|
||||
});
|
||||
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_NAVIGATE_NEXT, () => {
|
||||
this.eventBus.on(CalendarEvents.CMD_NAVIGATE_NEXT, () => {
|
||||
this.handleNavigateNext();
|
||||
});
|
||||
|
||||
// Drawer toggle via EventBus
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_DRAWER_TOGGLE, () => {
|
||||
this.eventBus.on(CalendarEvents.CMD_DRAWER_TOGGLE, () => {
|
||||
this.headerDrawerManager.toggle();
|
||||
});
|
||||
|
||||
// Render command via EventBus
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_RENDER, ((e: CustomEvent) => {
|
||||
this.eventBus.on(CalendarEvents.CMD_RENDER, ((e: CustomEvent) => {
|
||||
const { viewId } = e.detail;
|
||||
this.handleRenderCommand(viewId);
|
||||
}) as EventListener);
|
||||
|
||||
// Workweek change via EventBus
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_WORKWEEK_CHANGE, ((e: CustomEvent) => {
|
||||
this.eventBus.on(CalendarEvents.CMD_WORKWEEK_CHANGE, ((e: CustomEvent) => {
|
||||
const { presetId } = e.detail;
|
||||
this.handleWorkweekChange(presetId);
|
||||
}) as EventListener);
|
||||
|
||||
// View update via EventBus
|
||||
this.eventBus.on(CoreEvents.CALENDAR_CMD_VIEW_UPDATE, ((e: CustomEvent) => {
|
||||
this.eventBus.on(CalendarEvents.CMD_VIEW_UPDATE, ((e: CustomEvent) => {
|
||||
const { type, values } = e.detail;
|
||||
this.handleViewUpdate(type, values);
|
||||
}) as EventListener);
|
||||
|
|
|
|||
12
src/v2/core/CalendarEvents.ts
Normal file
12
src/v2/core/CalendarEvents.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* CalendarEvents - Command and status events for CalendarApp
|
||||
*/
|
||||
export const CalendarEvents = {
|
||||
// Command events (host → calendar)
|
||||
CMD_NAVIGATE_PREV: 'calendar:cmd:navigate:prev',
|
||||
CMD_NAVIGATE_NEXT: 'calendar:cmd:navigate:next',
|
||||
CMD_DRAWER_TOGGLE: 'calendar:cmd:drawer:toggle',
|
||||
CMD_RENDER: 'calendar:cmd:render',
|
||||
CMD_WORKWEEK_CHANGE: 'calendar:cmd:workweek:change',
|
||||
CMD_VIEW_UPDATE: 'calendar:cmd:view:update'
|
||||
} as const;
|
||||
|
|
@ -5,7 +5,7 @@ import { CalendarApp } from '../core/CalendarApp';
|
|||
import { DateService } from '../core/DateService';
|
||||
import { ResourceService } from '../storage/resources/ResourceService';
|
||||
import { IEventBus } from '../types/CalendarTypes';
|
||||
import { CoreEvents } from '../constants/CoreEvents';
|
||||
import { CalendarEvents } from '../core/CalendarEvents';
|
||||
|
||||
export class DemoApp {
|
||||
private container!: HTMLElement;
|
||||
|
|
@ -50,16 +50,16 @@ export class DemoApp {
|
|||
this.setupStatusListeners();
|
||||
|
||||
// Initial render
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_RENDER, { viewId: this.currentView });
|
||||
this.eventBus.emit(CalendarEvents.CMD_RENDER, { viewId: this.currentView });
|
||||
}
|
||||
|
||||
private setupNavigation(): void {
|
||||
document.getElementById('btn-prev')!.onclick = () => {
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_NAVIGATE_PREV);
|
||||
this.eventBus.emit(CalendarEvents.CMD_NAVIGATE_PREV);
|
||||
};
|
||||
|
||||
document.getElementById('btn-next')!.onclick = () => {
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_NAVIGATE_NEXT);
|
||||
this.eventBus.emit(CalendarEvents.CMD_NAVIGATE_NEXT);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ export class DemoApp {
|
|||
if (view) {
|
||||
this.currentView = view;
|
||||
this.updateSelectorVisibility();
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_RENDER, { viewId: view });
|
||||
this.eventBus.emit(CalendarEvents.CMD_RENDER, { viewId: view });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -88,7 +88,7 @@ export class DemoApp {
|
|||
|
||||
private setupDrawerToggle(): void {
|
||||
document.getElementById('btn-drawer')!.onclick = () => {
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_DRAWER_TOGGLE);
|
||||
this.eventBus.emit(CalendarEvents.CMD_DRAWER_TOGGLE);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ export class DemoApp {
|
|||
const workweekSelect = document.getElementById('workweek-select') as HTMLSelectElement;
|
||||
workweekSelect?.addEventListener('change', () => {
|
||||
const presetId = workweekSelect.value;
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_WORKWEEK_CHANGE, { presetId });
|
||||
this.eventBus.emit(CalendarEvents.CMD_WORKWEEK_CHANGE, { presetId });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ export class DemoApp {
|
|||
container.addEventListener('change', () => {
|
||||
const checked = container.querySelectorAll('input:checked') as NodeListOf<HTMLInputElement>;
|
||||
const values = Array.from(checked).map(cb => cb.value);
|
||||
this.eventBus.emit(CoreEvents.CALENDAR_CMD_VIEW_UPDATE, { type: 'resource', values });
|
||||
this.eventBus.emit(CalendarEvents.CMD_VIEW_UPDATE, { type: 'resource', values });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue