diff --git a/src/content/components/events/comms.ts b/src/content/components/events/comms.ts index 965087a..e5ba62a 100644 --- a/src/content/components/events/comms.ts +++ b/src/content/components/events/comms.ts @@ -1,4 +1,4 @@ -import type { MaintenancePopupEventsMap } from "$content/components/events/tagging-profile-popup-events"; +import type { TaggingProfilePopupEventsMap } from "$content/components/events/tagging-profile-popup-events"; import { BaseComponent } from "$content/components/base/BaseComponent"; import type { FullscreenViewerEventsMap } from "$content/components/events/fullscreen-viewer-events"; import type { BooruEventsMap } from "$content/components/events/booru-events"; @@ -7,7 +7,7 @@ import type { TagDropdownEvents } from "$content/components/events/tag-dropdown- import type { PresetBlockEventsMap } from "$content/components/events/preset-block-events"; type EventsMapping = - MaintenancePopupEventsMap + TaggingProfilePopupEventsMap & FullscreenViewerEventsMap & BooruEventsMap & TagsFormEventsMap diff --git a/src/content/components/events/tagging-profile-popup-events.ts b/src/content/components/events/tagging-profile-popup-events.ts index 89bc9c4..668c850 100644 --- a/src/content/components/events/tagging-profile-popup-events.ts +++ b/src/content/components/events/tagging-profile-popup-events.ts @@ -6,7 +6,7 @@ export const EVENT_TAGS_UPDATED = 'tags-updated'; export type ProfilePopupState = 'ready' | 'processing' | 'failed' | 'complete' | 'waiting'; -export interface MaintenancePopupEventsMap { +export interface TaggingProfilePopupEventsMap { [EVENT_ACTIVE_PROFILE_CHANGED]: TaggingProfile | null; [EVENT_PROFILE_POPUP_STATE_CHANGED]: ProfilePopupState; [EVENT_TAGS_UPDATED]: Map | null; diff --git a/src/content/components/extension/MediaBoxTools.ts b/src/content/components/extension/MediaBoxTools.ts index 832512b..1de65b7 100644 --- a/src/content/components/extension/MediaBoxTools.ts +++ b/src/content/components/extension/MediaBoxTools.ts @@ -8,7 +8,7 @@ import type TaggingProfile from "$entities/TaggingProfile"; export class MediaBoxTools extends BaseComponent { #mediaBox: MediaBox | null = null; - #maintenancePopup: TaggingProfilePopup | null = null; + #popup: TaggingProfilePopup | null = null; init() { const mediaBoxElement = this.container.closest('.media-box'); @@ -34,8 +34,8 @@ export class MediaBoxTools extends BaseComponent { component.initialize(); } - if (!this.#maintenancePopup && component instanceof TaggingProfilePopup) { - this.#maintenancePopup = component; + if (!this.#popup && component instanceof TaggingProfilePopup) { + this.#popup = component; } } @@ -46,10 +46,6 @@ export class MediaBoxTools extends BaseComponent { this.container.classList.toggle('has-active-profile', profileChangedEvent.detail !== null); } - get maintenancePopup(): TaggingProfilePopup | null { - return this.#maintenancePopup; - } - get mediaBox(): MediaBox | null { return this.#mediaBox; } diff --git a/src/content/components/extension/profiles/TaggingProfilePopup.ts b/src/content/components/extension/profiles/TaggingProfilePopup.ts index d551336..0b912cd 100644 --- a/src/content/components/extension/profiles/TaggingProfilePopup.ts +++ b/src/content/components/extension/profiles/TaggingProfilePopup.ts @@ -373,7 +373,7 @@ export class TaggingProfilePopup extends BaseComponent { } }); - const unsubscribeFromMaintenanceSettings = this.#preferences.subscribe(settings => { + const unsubscribeFromPreferences = this.#preferences.subscribe(settings => { if (settings.activeProfile === lastActiveProfileId) { return; } @@ -395,7 +395,7 @@ export class TaggingProfilePopup extends BaseComponent { return () => { unsubscribeFromProfilesChanges(); - unsubscribeFromMaintenanceSettings(); + unsubscribeFromPreferences(); } } diff --git a/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts b/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts index 2958104..dc77501 100644 --- a/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts +++ b/src/content/components/extension/profiles/TaggingProfileStatusIcon.ts @@ -25,10 +25,10 @@ export class TaggingProfileStatusIcon extends BaseComponent { throw new Error('Status icon element initialized outside of the media box!'); } - on(this.#mediaBoxTools, EVENT_PROFILE_POPUP_STATE_CHANGED, this.#onMaintenanceStateChanged.bind(this)); + on(this.#mediaBoxTools, EVENT_PROFILE_POPUP_STATE_CHANGED, this.#onPopupStateChanged.bind(this)); } - #onMaintenanceStateChanged(stateChangeEvent: CustomEvent) { + #onPopupStateChanged(stateChangeEvent: CustomEvent) { // TODO Replace those with FontAwesome icons later. Those icons can probably be sourced from the website itself. switch (stateChangeEvent.detail) { case "ready":