2 Commits

Author SHA1 Message Date
ca7294c3f7 new version: 0.3.1 2024-07-22 15:06:06 +03:00
d109ba8974 feat: nice update indicator in header 2024-07-22 15:04:29 +03:00
5 changed files with 25 additions and 22 deletions

View File

@@ -1,11 +1,3 @@
@if (serviceWorkerEnabled) {
@if (hasUpdate) {
<h1>Update available</h1>
<button (click)="update()">Update</button>
} @else {
<h1>Update not available</h1>
}
}
<app-header></app-header>
<div class="md:h-12 h-16"></div>
<div

View File

@@ -23,17 +23,4 @@ import { TabBarComponent } from "./components/tab-bar/tab-bar.component";
})
export class AppComponent {
title = "NwaifuAnime";
constructor(private sw: AppService) {}
get hasUpdate() {
return this.sw.isUpdateAvailable;
}
update() {
this.sw.update();
}
get serviceWorkerEnabled() {
return this.sw.serviceWorkerEnabled;
}
}

View File

@@ -8,6 +8,15 @@
<img src="pic/Blank-profile.png" alt="Profile pic" class="w-full h-full" />
</div>
</button>
@if (this.swEnabled && this.swHasUpdate) {
<button title="Update" (click)="swUpdate()" class="md:w-fit w-full">
<div
class="h-8 md:w-8 w-full rounded-md bg-green-300 flex flex-col justify-center items-center md:ms-1 ms-0 md:mt-0 mt-2"
>
<i class="lni lni-download text-gray-700"></i>
</div>
</button>
}
</div>
<div
[class]="

View File

@@ -9,6 +9,7 @@ import {
} from "@angular/core";
import { RouterLink } from "@angular/router";
import { Subject } from "rxjs";
import { AppService } from "../../app.service";
import { SearchFieldComponent } from "../search-field/search-field.component";
@Component({
@@ -24,6 +25,20 @@ export class HeaderComponent implements AfterViewInit, OnDestroy {
@ViewChild("profileMenu") profileMenu: ElementRef<HTMLDivElement> | null = null;
private destroy$ = new Subject<void>();
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)) {

View File

@@ -1,6 +1,6 @@
{
"name": "nwaifu-web",
"version": "0.3.0",
"version": "0.3.1",
"scripts": {
"ng": "ng",
"start": "nx serve NwaifuWeb",