diff --git a/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.html b/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.html index 4af1d285c..790e1df8e 100644 --- a/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.html +++ b/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.html @@ -11,6 +11,33 @@
+
+
+

+ + {{ t('appearance.sectionTitle') }} +

+
+ +
+
+
+
+ + + +
+

+ + {{ t('appearance.supportButtonAnimationDesc') }} +

+
+
+
+
+

diff --git a/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.ts b/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.ts index bdc865a0c..9ca471cf0 100644 --- a/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.ts +++ b/booklore-ui/src/app/features/settings/global-preferences/global-preferences.component.ts @@ -14,6 +14,8 @@ import {Slider} from 'primeng/slider'; import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; +export const SUPPORT_ANIMATION_KEY = 'booklore-support-animation'; + @Component({ selector: 'app-global-preferences', standalone: true, @@ -38,6 +40,8 @@ export class GlobalPreferencesComponent implements OnInit { enableTelemetry: true, }; + supportButtonAnimation = localStorage.getItem(SUPPORT_ANIMATION_KEY) !== 'false'; + coverCroppingSettings: CoverCroppingSettings = { verticalCroppingEnabled: false, horizontalCroppingEnabled: false, @@ -85,6 +89,12 @@ export class GlobalPreferencesComponent implements OnInit { } } + onSupportAnimationChange(checked: boolean): void { + this.supportButtonAnimation = checked; + localStorage.setItem(SUPPORT_ANIMATION_KEY, String(checked)); + window.dispatchEvent(new StorageEvent('storage', {key: SUPPORT_ANIMATION_KEY, newValue: String(checked)})); + } + onCoverCroppingChange(): void { this.saveSetting(AppSettingKey.COVER_CROPPING_SETTINGS, this.coverCroppingSettings); } diff --git a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.html b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.html index ac2923a04..3d3db6b53 100644 --- a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.html +++ b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.html @@ -117,12 +117,16 @@ -
  • - - - - - +
  • + @if (supportAnimationEnabled) { + + + + + + }
  • diff --git a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.scss b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.scss index 1db6c9198..0f3f17796 100644 --- a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.scss +++ b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.scss @@ -133,6 +133,18 @@ transition: filter 0.3s; } +.heart-button-static { + .heart-icon { + animation: none; + filter: none; + } + + &:hover .heart-icon { + animation: none; + filter: none; + } +} + .mobile-trigger { display: none; position: relative; diff --git a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.ts b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.ts index 156f5eb2e..66b543aa3 100644 --- a/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.ts +++ b/booklore-ui/src/app/shared/layout/component/layout-topbar/app.topbar.component.ts @@ -28,6 +28,7 @@ import {Menu} from 'primeng/menu'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {AVAILABLE_LANGS, LANG_LABELS} from '../../../../core/config/transloco-loader'; import {LANG_STORAGE_KEY} from '../../../../core/config/language-initializer'; +import {SUPPORT_ANIMATION_KEY} from '../../../../features/settings/global-preferences/global-preferences.component'; @Component({ selector: 'app-topbar', @@ -70,6 +71,7 @@ export class AppTopBarComponent implements OnDestroy { showPulse = false; hasAnyTasks = false; hasPendingBookdropFiles = false; + supportAnimationEnabled = localStorage.getItem(SUPPORT_ANIMATION_KEY) !== 'false'; private eventTimer: number | undefined; private destroy$ = new Subject(); @@ -101,6 +103,9 @@ export class AppTopBarComponent implements OnDestroy { icon: lang === this.activeLang ? 'pi pi-check' : undefined, command: () => this.switchLanguage(lang), })); + this.onStorageChange = this.onStorageChange.bind(this); + window.addEventListener('storage', this.onStorageChange); + this.subscribeToMetadataProgress(); this.subscribeToNotifications(); @@ -132,10 +137,17 @@ export class AppTopBarComponent implements OnDestroy { ngOnDestroy(): void { if (this.ref) this.ref.close(); clearTimeout(this.eventTimer); + window.removeEventListener('storage', this.onStorageChange); this.destroy$.next(); this.destroy$.complete(); } + private onStorageChange(event: StorageEvent): void { + if (event.key === SUPPORT_ANIMATION_KEY) { + this.supportAnimationEnabled = event.newValue !== 'false'; + } + } + toggleMenu() { this.isMenuVisible = !this.isMenuVisible; this.layoutService.onMenuToggle(); diff --git a/booklore-ui/src/i18n/en/settings-application.json b/booklore-ui/src/i18n/en/settings-application.json index 453c41d1b..f998fe416 100644 --- a/booklore-ui/src/i18n/en/settings-application.json +++ b/booklore-ui/src/i18n/en/settings-application.json @@ -34,6 +34,11 @@ "invalidInput": "Invalid Input", "invalidInputDetail": "Please enter a valid max file upload size in MB." }, + "appearance": { + "sectionTitle": "Appearance", + "supportButtonAnimation": "Support Button Animation", + "supportButtonAnimationDesc": "Show the animated heart effect on the support button in the top bar. Disabling this keeps the button visible but removes the animation." + }, "telemetry": { "sectionTitle": "Telemetry", "enableTelemetry": "Enable Telemetry", diff --git a/booklore-ui/src/i18n/es/settings-application.json b/booklore-ui/src/i18n/es/settings-application.json index 567008467..53642ec09 100644 --- a/booklore-ui/src/i18n/es/settings-application.json +++ b/booklore-ui/src/i18n/es/settings-application.json @@ -34,6 +34,11 @@ "invalidInput": "Entrada inválida", "invalidInputDetail": "Introduce un tamaño máximo de carga de archivo válido en MB." }, + "appearance": { + "sectionTitle": "Apariencia", + "supportButtonAnimation": "Animación del botón de apoyo", + "supportButtonAnimationDesc": "Muestra el efecto animado de corazón en el botón de apoyo en la barra superior. Desactivar esto mantiene el botón visible pero elimina la animación." + }, "telemetry": { "sectionTitle": "Telemetría", "enableTelemetry": "Habilitar telemetría",