Initial settings, download UI, various bugfixes

This commit is contained in:
Geomitron
2020-02-09 21:15:40 -05:00
parent 89948b118b
commit de39ad4f1e
33 changed files with 1034 additions and 110 deletions

View File

@@ -0,0 +1,31 @@
import { Component, ChangeDetectorRef } from '@angular/core'
import { Download } from '../../../../../electron/shared/interfaces/download.interface'
import { DownloadService } from '../../../../core/services/download.service'
import * as _ from 'underscore'
@Component({
selector: 'app-downloads-modal',
templateUrl: './downloads-modal.component.html',
styleUrls: ['./downloads-modal.component.scss']
})
export class DownloadsModalComponent {
downloads: Download[] = []
constructor(downloadService: DownloadService, private ref: ChangeDetectorRef) {
const detectChanges = _.throttle(() => this.ref.detectChanges(), 30)
downloadService.onDownloadUpdated(download => {
const index = this.downloads.findIndex(thisDownload => thisDownload.versionID == download.versionID)
if (index == -1) {
this.downloads.push(download)
} else {
this.downloads[index] = download
}
detectChanges()
})
}
trackByVersionID(_index: number, item: Download) {
return item.versionID
}
}