From 9b262393fa3c769d053ce6e51f1a1e9cb19b237a Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sun, 29 Mar 2026 03:48:12 +0400 Subject: [PATCH] Fixed event & underlying type not updated --- .../components/events/maintenance-popup-events.ts | 6 +++--- .../extension/profiles/TaggingProfilePopup.ts | 10 +++++----- .../extension/profiles/TaggingProfileStatusIcon.ts | 9 ++++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/content/components/events/maintenance-popup-events.ts b/src/content/components/events/maintenance-popup-events.ts index 95c780f..89bc9c4 100644 --- a/src/content/components/events/maintenance-popup-events.ts +++ b/src/content/components/events/maintenance-popup-events.ts @@ -1,13 +1,13 @@ import type TaggingProfile from "$entities/TaggingProfile"; export const EVENT_ACTIVE_PROFILE_CHANGED = 'active-profile-changed'; -export const EVENT_MAINTENANCE_STATE_CHANGED = 'maintenance-state-change'; +export const EVENT_PROFILE_POPUP_STATE_CHANGED = 'maintenance-state-change'; export const EVENT_TAGS_UPDATED = 'tags-updated'; -type MaintenanceState = 'processing' | 'failed' | 'complete' | 'waiting'; +export type ProfilePopupState = 'ready' | 'processing' | 'failed' | 'complete' | 'waiting'; export interface MaintenancePopupEventsMap { [EVENT_ACTIVE_PROFILE_CHANGED]: TaggingProfile | null; - [EVENT_MAINTENANCE_STATE_CHANGED]: MaintenanceState; + [EVENT_PROFILE_POPUP_STATE_CHANGED]: ProfilePopupState; [EVENT_TAGS_UPDATED]: Map | null; } diff --git a/src/content/components/extension/profiles/TaggingProfilePopup.ts b/src/content/components/extension/profiles/TaggingProfilePopup.ts index a63b9b4..14074fc 100644 --- a/src/content/components/extension/profiles/TaggingProfilePopup.ts +++ b/src/content/components/extension/profiles/TaggingProfilePopup.ts @@ -7,7 +7,7 @@ import { tagsBlacklist } from "$config/tags"; import { emitterAt } from "$content/components/events/comms"; import { EVENT_ACTIVE_PROFILE_CHANGED, - EVENT_MAINTENANCE_STATE_CHANGED, + EVENT_PROFILE_POPUP_STATE_CHANGED, EVENT_TAGS_UPDATED } from "$content/components/events/maintenance-popup-events"; import type { MediaBoxTools } from "$content/components/extension/MediaBoxTools"; @@ -183,7 +183,7 @@ export class TaggingProfilePopup extends BaseComponent { } this.#isPlanningToSubmit = true; - this.#emitter.emit(EVENT_MAINTENANCE_STATE_CHANGED, 'waiting'); + this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'waiting'); } } @@ -210,7 +210,7 @@ export class TaggingProfilePopup extends BaseComponent { this.#isPlanningToSubmit = false; this.#isSubmitting = true; - this.#emitter.emit(EVENT_MAINTENANCE_STATE_CHANGED, 'processing'); + this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'processing'); let maybeTagsAndAliasesAfterUpdate; @@ -252,7 +252,7 @@ export class TaggingProfilePopup extends BaseComponent { TaggingProfilePopup.#notifyAboutPendingSubmission(false); - this.#emitter.emit(EVENT_MAINTENANCE_STATE_CHANGED, 'failed'); + this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'failed'); this.#isSubmitting = false; return; @@ -262,7 +262,7 @@ export class TaggingProfilePopup extends BaseComponent { this.#emitter.emit(EVENT_TAGS_UPDATED, maybeTagsAndAliasesAfterUpdate); } - this.#emitter.emit(EVENT_MAINTENANCE_STATE_CHANGED, 'complete'); + this.#emitter.emit(EVENT_PROFILE_POPUP_STATE_CHANGED, 'complete'); this.#tagsToAdd.clear(); this.#tagsToRemove.clear(); diff --git a/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts b/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts index 6e5ab8b..b1b1246 100644 --- a/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts +++ b/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts @@ -1,7 +1,10 @@ import { BaseComponent } from "$content/components/base/BaseComponent"; import { getComponent } from "$content/components/base/component-utils"; import { on } from "$content/components/events/comms"; -import { EVENT_MAINTENANCE_STATE_CHANGED } from "$content/components/events/maintenance-popup-events"; +import { + EVENT_PROFILE_POPUP_STATE_CHANGED, + type ProfilePopupState +} from "$content/components/events/maintenance-popup-events"; import type { MediaBoxTools } from "$content/components/extension/MediaBoxTools"; export class TaggingProfileStatusIcon extends BaseComponent { @@ -22,10 +25,10 @@ export class TaggingProfileStatusIcon extends BaseComponent { throw new Error('Status icon element initialized outside of the media box!'); } - on(this.#mediaBoxTools, EVENT_MAINTENANCE_STATE_CHANGED, this.#onMaintenanceStateChanged.bind(this)); + on(this.#mediaBoxTools, EVENT_PROFILE_POPUP_STATE_CHANGED, this.#onMaintenanceStateChanged.bind(this)); } - #onMaintenanceStateChanged(stateChangeEvent: CustomEvent) { + #onMaintenanceStateChanged(stateChangeEvent: CustomEvent) { // TODO Replace those with FontAwesome icons later. Those icons can probably be sourced from the website itself. switch (stateChangeEvent.detail) { case "ready":