Improve update UI

This commit is contained in:
Geomitron
2024-07-10 23:15:38 -05:00
parent ba357d5fea
commit 0c8b20c3e9
9 changed files with 53 additions and 39 deletions

View File

@@ -1,11 +1,11 @@
<div class="navbar p-0 min-h-0 bg-base-100" style="-webkit-app-region: drag">
<div style="-webkit-app-region: no-drag">
<button class="btn btn-square btn-ghost rounded-none px-11" routerLinkActive="btn-active" routerLink="/browse">Browse</button>
<!-- TODO <a class="btn btn-square btn-ghost rounded-none" routerLinkActive="btn-active" routerLink="/library">Library</a> -->
<button class="btn btn-square btn-ghost rounded-none px-11 flex flex-nowrap" routerLinkActive="btn-active" routerLink="/settings">
<div *ngIf="updateAvailable" class="badge badge-accent badge-xs"></div>
<i *ngIf="updateAvailable === null" class="bi bi-exclamation-triangle-fill text-warning"></i>
<button class="btn btn-ghost rounded-none" routerLinkActive="btn-active" routerLink="/browse">Browse</button>
<!-- TODO <a class="btn btn-ghost rounded-none" routerLinkActive="btn-active" routerLink="/library">Library</a> -->
<button class="btn btn-ghost rounded-none flex flex-nowrap" routerLinkActive="btn-active" routerLink="/settings">
<i *ngIf="updateAvailable === 'error'" class="bi bi-exclamation-triangle-fill text-warning"></i>
Settings
<div *ngIf="updateAvailable === 'yes'" class="badge badge-accent badge-sm">Update Available</div>
</button>
</div>
<div class="flex-1"></div>

View File

@@ -7,7 +7,7 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core'
export class ToolbarComponent implements OnInit {
isMaximized: boolean
updateAvailable: boolean | null = false
updateAvailable: 'yes' | 'no' | 'error' = 'no'
constructor(private ref: ChangeDetectorRef) { }
@@ -23,11 +23,11 @@ export class ToolbarComponent implements OnInit {
})
window.electron.on.updateAvailable(result => {
this.updateAvailable = result !== null
this.updateAvailable = result !== null ? 'yes' : 'no'
this.ref.detectChanges()
})
window.electron.on.updateError(() => {
this.updateAvailable = null
this.updateAvailable = 'error'
this.ref.detectChanges()
})
this.updateAvailable = await window.electron.invoke.getUpdateAvailable()