add option to disable support button animation (#3075) (#3094)

This commit is contained in:
ACX
2026-02-27 18:03:57 -07:00
committed by GitHub
parent c6e5cfe534
commit c59df0bfef
7 changed files with 81 additions and 6 deletions
@@ -11,6 +11,33 @@
</div> </div>
<div class="settings-content"> <div class="settings-content">
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-palette"></i>
{{ t('appearance.sectionTitle') }}
</h3>
</div>
<div class="settings-card">
<div class="setting-item">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">{{ t('appearance.supportButtonAnimation') }}</label>
<p-toggleswitch
[(ngModel)]="supportButtonAnimation"
(onChange)="onSupportAnimationChange($event.checked)">
</p-toggleswitch>
</div>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
{{ t('appearance.supportButtonAnimationDesc') }}
</p>
</div>
</div>
</div>
</div>
<div class="preferences-section"> <div class="preferences-section">
<div class="section-header"> <div class="section-header">
<h3 class="section-title"> <h3 class="section-title">
@@ -14,6 +14,8 @@ import {Slider} from 'primeng/slider';
import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component'; import {ExternalDocLinkComponent} from '../../../shared/components/external-doc-link/external-doc-link.component';
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
export const SUPPORT_ANIMATION_KEY = 'booklore-support-animation';
@Component({ @Component({
selector: 'app-global-preferences', selector: 'app-global-preferences',
standalone: true, standalone: true,
@@ -38,6 +40,8 @@ export class GlobalPreferencesComponent implements OnInit {
enableTelemetry: true, enableTelemetry: true,
}; };
supportButtonAnimation = localStorage.getItem(SUPPORT_ANIMATION_KEY) !== 'false';
coverCroppingSettings: CoverCroppingSettings = { coverCroppingSettings: CoverCroppingSettings = {
verticalCroppingEnabled: false, verticalCroppingEnabled: false,
horizontalCroppingEnabled: 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 { onCoverCroppingChange(): void {
this.saveSetting(AppSettingKey.COVER_CROPPING_SETTINGS, this.coverCroppingSettings); this.saveSetting(AppSettingKey.COVER_CROPPING_SETTINGS, this.coverCroppingSettings);
} }
@@ -117,12 +117,16 @@
</p-popover> </p-popover>
</li> </li>
<li class="topbar-item-relative heart-button topbar-item" (click)="openGithubSupportDialog()"> <li class="topbar-item-relative heart-button topbar-item"
<span class="heart-ripple"></span> [class.heart-button-static]="!supportAnimationEnabled"
<span class="heart-ripple heart-ripple-delayed"></span> (click)="openGithubSupportDialog()">
<span class="heart-orbit heart-orbit-1"></span> @if (supportAnimationEnabled) {
<span class="heart-orbit heart-orbit-2"></span> <span class="heart-ripple"></span>
<span class="heart-orbit heart-orbit-3"></span> <span class="heart-ripple heart-ripple-delayed"></span>
<span class="heart-orbit heart-orbit-1"></span>
<span class="heart-orbit heart-orbit-2"></span>
<span class="heart-orbit heart-orbit-3"></span>
}
<i class="pi pi-heart-fill heart-icon"></i> <i class="pi pi-heart-fill heart-icon"></i>
</li> </li>
<li class="topbar-item-relative"> <li class="topbar-item-relative">
@@ -133,6 +133,18 @@
transition: filter 0.3s; transition: filter 0.3s;
} }
.heart-button-static {
.heart-icon {
animation: none;
filter: none;
}
&:hover .heart-icon {
animation: none;
filter: none;
}
}
.mobile-trigger { .mobile-trigger {
display: none; display: none;
position: relative; position: relative;
@@ -28,6 +28,7 @@ import {Menu} from 'primeng/menu';
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco'; import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
import {AVAILABLE_LANGS, LANG_LABELS} from '../../../../core/config/transloco-loader'; import {AVAILABLE_LANGS, LANG_LABELS} from '../../../../core/config/transloco-loader';
import {LANG_STORAGE_KEY} from '../../../../core/config/language-initializer'; import {LANG_STORAGE_KEY} from '../../../../core/config/language-initializer';
import {SUPPORT_ANIMATION_KEY} from '../../../../features/settings/global-preferences/global-preferences.component';
@Component({ @Component({
selector: 'app-topbar', selector: 'app-topbar',
@@ -70,6 +71,7 @@ export class AppTopBarComponent implements OnDestroy {
showPulse = false; showPulse = false;
hasAnyTasks = false; hasAnyTasks = false;
hasPendingBookdropFiles = false; hasPendingBookdropFiles = false;
supportAnimationEnabled = localStorage.getItem(SUPPORT_ANIMATION_KEY) !== 'false';
private eventTimer: number | undefined; private eventTimer: number | undefined;
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@@ -101,6 +103,9 @@ export class AppTopBarComponent implements OnDestroy {
icon: lang === this.activeLang ? 'pi pi-check' : undefined, icon: lang === this.activeLang ? 'pi pi-check' : undefined,
command: () => this.switchLanguage(lang), command: () => this.switchLanguage(lang),
})); }));
this.onStorageChange = this.onStorageChange.bind(this);
window.addEventListener('storage', this.onStorageChange);
this.subscribeToMetadataProgress(); this.subscribeToMetadataProgress();
this.subscribeToNotifications(); this.subscribeToNotifications();
@@ -132,10 +137,17 @@ export class AppTopBarComponent implements OnDestroy {
ngOnDestroy(): void { ngOnDestroy(): void {
if (this.ref) this.ref.close(); if (this.ref) this.ref.close();
clearTimeout(this.eventTimer); clearTimeout(this.eventTimer);
window.removeEventListener('storage', this.onStorageChange);
this.destroy$.next(); this.destroy$.next();
this.destroy$.complete(); this.destroy$.complete();
} }
private onStorageChange(event: StorageEvent): void {
if (event.key === SUPPORT_ANIMATION_KEY) {
this.supportAnimationEnabled = event.newValue !== 'false';
}
}
toggleMenu() { toggleMenu() {
this.isMenuVisible = !this.isMenuVisible; this.isMenuVisible = !this.isMenuVisible;
this.layoutService.onMenuToggle(); this.layoutService.onMenuToggle();
@@ -34,6 +34,11 @@
"invalidInput": "Invalid Input", "invalidInput": "Invalid Input",
"invalidInputDetail": "Please enter a valid max file upload size in MB." "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": { "telemetry": {
"sectionTitle": "Telemetry", "sectionTitle": "Telemetry",
"enableTelemetry": "Enable Telemetry", "enableTelemetry": "Enable Telemetry",
@@ -34,6 +34,11 @@
"invalidInput": "Entrada inválida", "invalidInput": "Entrada inválida",
"invalidInputDetail": "Introduce un tamaño máximo de carga de archivo válido en MB." "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": { "telemetry": {
"sectionTitle": "Telemetría", "sectionTitle": "Telemetría",
"enableTelemetry": "Habilitar telemetría", "enableTelemetry": "Habilitar telemetría",