StatusBar and Sidebar views update correctly

This commit is contained in:
Geomitron
2020-02-09 23:49:23 -05:00
parent de39ad4f1e
commit 1e16371958
6 changed files with 63 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
import { Component } from '@angular/core'
import { Component, ChangeDetectorRef } from '@angular/core'
import { SongResult } from 'src/electron/shared/interfaces/search.interface'
import { DownloadService } from 'src/app/core/services/download.service'
@Component({
selector: 'app-status-bar',
@@ -7,9 +9,18 @@ import { Component } from '@angular/core'
})
export class StatusBarComponent {
resultCount = 0
downloading = false
percent = 0
selectedResults: SongResult[] = []
constructor() { }
constructor(downloadService: DownloadService, ref: ChangeDetectorRef) {
downloadService.onDownloadUpdated(() => {
this.downloading = downloadService.downloadCount > 0
this.percent = downloadService.totalPercent
ref.detectChanges()
})
}
showDownloads() {
$('#downloadsModal').modal('show')