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
@@ -117,12 +117,16 @@
</p-popover>
</li>
<li class="topbar-item-relative heart-button topbar-item" (click)="openGithubSupportDialog()">
<span class="heart-ripple"></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>
<li class="topbar-item-relative heart-button topbar-item"
[class.heart-button-static]="!supportAnimationEnabled"
(click)="openGithubSupportDialog()">
@if (supportAnimationEnabled) {
<span class="heart-ripple"></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>
</li>
<li class="topbar-item-relative">
@@ -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;
@@ -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<void>();
@@ -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();