mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Clarified result count
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<div class="ui bottom borderless menu">
|
||||
<div *ngIf="resultCount > 0" class="item">{{resultCount}} Result{{resultCount == 1 ? '' : 's'}}</div>
|
||||
<div *ngIf="resultCount > 0" class="item">{{resultCount}}{{allResultsVisible ? '' : '+'}} Result{{resultCount == 1 ? '' : 's'}}</div>
|
||||
<div class="item">
|
||||
<button *ngIf="selectedResults.length > 0" (click)="downloadSelected()" class="ui positive button">Download Selected</button>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@ export class StatusBarComponent {
|
||||
constructor(
|
||||
private electronService: ElectronService,
|
||||
private downloadService: DownloadService,
|
||||
searchService: SearchService,
|
||||
private searchService: SearchService,
|
||||
ref: ChangeDetectorRef
|
||||
) {
|
||||
downloadService.onDownloadUpdated(() => {
|
||||
@@ -43,6 +43,10 @@ export class StatusBarComponent {
|
||||
})
|
||||
}
|
||||
|
||||
get allResultsVisible() {
|
||||
return this.searchService.allResultsVisible
|
||||
}
|
||||
|
||||
showDownloads() {
|
||||
$('#downloadsModal').modal('show')
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ export class SearchService {
|
||||
private resultsChangedEmitter = new EventEmitter<SongResult[]>() // For when any results change
|
||||
private newResultsEmitter = new EventEmitter<SongResult[]>() // For when a new search happens
|
||||
private results: SongResult[] = []
|
||||
private awaitingResults = false
|
||||
private awaitingResults = false // TODO: add loading icon below table when this is true
|
||||
private currentQuery: SongSearch
|
||||
private allResultsVisible = true
|
||||
private _allResultsVisible = true
|
||||
|
||||
constructor(private electronService: ElectronService) { }
|
||||
|
||||
@@ -39,7 +39,7 @@ export class SearchService {
|
||||
}
|
||||
|
||||
async updateScroll() {
|
||||
if (!this.awaitingResults && !this.allResultsVisible) {
|
||||
if (!this.awaitingResults && !this._allResultsVisible) {
|
||||
this.awaitingResults = true
|
||||
this.currentQuery.offset += 20
|
||||
this.results.push(...this.trimLastChart(await this.electronService.invoke('song-search', this.currentQuery)))
|
||||
@@ -52,11 +52,15 @@ export class SearchService {
|
||||
trimLastChart(results: SongResult[]) {
|
||||
if (results.length > 20) {
|
||||
results.splice(20, 1)
|
||||
this.allResultsVisible = false
|
||||
this._allResultsVisible = false
|
||||
} else {
|
||||
this.allResultsVisible = true
|
||||
this._allResultsVisible = true
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
get allResultsVisible() {
|
||||
return this._allResultsVisible
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user