From d109ba89740db32580233878a0d5907d244f5bd9 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Mon, 22 Jul 2024 15:04:29 +0300 Subject: [PATCH] feat: nice update indicator in header --- apps/NwaifuAnime/src/app/app.component.html | 8 -------- apps/NwaifuAnime/src/app/app.component.ts | 13 ------------- .../app/components/header/header.component.html | 9 +++++++++ .../src/app/components/header/header.component.ts | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/apps/NwaifuAnime/src/app/app.component.html b/apps/NwaifuAnime/src/app/app.component.html index f333933..6bbd915 100644 --- a/apps/NwaifuAnime/src/app/app.component.html +++ b/apps/NwaifuAnime/src/app/app.component.html @@ -1,11 +1,3 @@ -@if (serviceWorkerEnabled) { - @if (hasUpdate) { -

Update available

- - } @else { -

Update not available

- } -}
+ @if (this.swEnabled && this.swHasUpdate) { + + }
| null = null; private destroy$ = new Subject(); + constructor(private swService: AppService) {} + + get swEnabled() { + return this.swService.serviceWorkerEnabled; + } + + swUpdate() { + this.swService.update(); + } + + get swHasUpdate() { + return this.swService.isUpdateAvailable; + } + @HostListener("window:click", ["$event"]) toggleProfileMenu(event: MouseEvent) { if (this.profileBtn && this.profileBtn.nativeElement.contains(event.target as Node)) {