diff --git a/src/app/components/browse/browse.component.ts b/src/app/components/browse/browse.component.ts
index 12fb6c7..aa830fd 100644
--- a/src/app/components/browse/browse.component.ts
+++ b/src/app/components/browse/browse.component.ts
@@ -1,7 +1,6 @@
import { Component, ViewChild, AfterViewInit } from '@angular/core'
import { ChartSidebarComponent } from './chart-sidebar/chart-sidebar.component'
import { StatusBarComponent } from './status-bar/status-bar.component'
-import { SongResult } from 'src/electron/shared/interfaces/search.interface'
import { ResultTableComponent } from './result-table/result-table.component'
@Component({
@@ -35,15 +34,6 @@ export class BrowseComponent implements AfterViewInit {
})
}
- onResultsUpdated(results: SongResult[]) {
- this.resultTable.results = results
- this.resultTable.onNewSearch()
- this.resultTable.checkAll(false)
- this.chartSidebar.selectVersion(undefined)
- this.statusBar.resultCount = results.length
- this.statusBar.selectedResults = []
- }
-
loadMoreResults() {
// TODO: use the same query as the current search, but append more results if there are any more to be viewed
}
diff --git a/src/app/components/browse/chart-sidebar/chart-sidebar.component.ts b/src/app/components/browse/chart-sidebar/chart-sidebar.component.ts
index 4eb7d88..f42b0b4 100644
--- a/src/app/components/browse/chart-sidebar/chart-sidebar.component.ts
+++ b/src/app/components/browse/chart-sidebar/chart-sidebar.component.ts
@@ -1,23 +1,35 @@
-import { Component } from '@angular/core'
+import { Component, OnInit } from '@angular/core'
import { SongResult } from '../../../../electron/shared/interfaces/search.interface'
import { ElectronService } from '../../../core/services/electron.service'
import { VersionResult } from '../../../../electron/shared/interfaces/songDetails.interface'
import { AlbumArtService } from '../../../core/services/album-art.service'
import { DownloadService } from '../../../core/services/download.service'
import { groupBy } from 'src/electron/shared/UtilFunctions'
+import { SearchService } from 'src/app/core/services/search.service'
@Component({
selector: 'app-chart-sidebar',
templateUrl: './chart-sidebar.component.html',
styleUrls: ['./chart-sidebar.component.scss']
})
-export class ChartSidebarComponent {
+export class ChartSidebarComponent implements OnInit {
private songResult: SongResult
selectedVersion: VersionResult
charts: VersionResult[][]
- constructor(private electronService: ElectronService, private albumArtService: AlbumArtService, private downloadService: DownloadService) { }
+ constructor(
+ private electronService: ElectronService,
+ private albumArtService: AlbumArtService,
+ private downloadService: DownloadService,
+ private searchService: SearchService
+ ) { }
+
+ ngOnInit() {
+ this.searchService.onNewSearch(() => {
+ this.selectVersion(undefined)
+ })
+ }
/**
* Displays the information for the selected song.
diff --git a/src/app/components/browse/result-table/result-table.component.ts b/src/app/components/browse/result-table/result-table.component.ts
index fa30db9..5d48fb4 100644
--- a/src/app/components/browse/result-table/result-table.component.ts
+++ b/src/app/components/browse/result-table/result-table.component.ts
@@ -1,24 +1,40 @@
-import { Component, Input, Output, EventEmitter, ViewChildren, QueryList, ViewChild } from '@angular/core'
+import { Component, Output, EventEmitter, ViewChildren, QueryList, ViewChild, OnInit } from '@angular/core'
import { SongResult } from '../../../../electron/shared/interfaces/search.interface'
import { ResultTableRowComponent } from './result-table-row/result-table-row.component'
import { CheckboxDirective } from 'src/app/core/directives/checkbox.directive'
+import { SearchService } from 'src/app/core/services/search.service'
@Component({
selector: 'app-result-table',
templateUrl: './result-table.component.html',
styleUrls: ['./result-table.component.scss']
})
-export class ResultTableComponent {
- @Input() results: SongResult[]
-
+export class ResultTableComponent implements OnInit {
+
@Output() rowClicked = new EventEmitter
()
@Output() songChecked = new EventEmitter()
@Output() songUnchecked = new EventEmitter()
-
+
@ViewChild(CheckboxDirective, { static: true }) checkboxColumn: CheckboxDirective
@ViewChildren('tableRow') tableRows: QueryList
+
+ results: SongResult[]
- constructor() { }
+ constructor(private searchService: SearchService) { }
+
+ ngOnInit() {
+ this.searchService.onNewSearch(() => {
+ this.checkboxColumn.check(false)
+ this.checkAll(false)
+ })
+
+ this.searchService.onSearchChanged(results => {
+ this.results = results
+ if (this.checkboxColumn.isChecked) {
+ this.checkAll(true)
+ }
+ })
+ }
onRowClicked(result: SongResult) {
this.rowClicked.emit(result)
@@ -39,8 +55,4 @@ export class ResultTableComponent {
onSongsDeselected(songs: SongResult['id'][]) {
this.tableRows.forEach(row => row.check(!songs.includes(row.songID)))
}
-
- onNewSearch() {
- this.checkboxColumn.check(false)
- }
}
\ No newline at end of file
diff --git a/src/app/components/browse/search-bar/search-bar.component.html b/src/app/components/browse/search-bar/search-bar.component.html
index b75e0e3..434839f 100644
--- a/src/app/components/browse/search-bar/search-bar.component.html
+++ b/src/app/components/browse/search-bar/search-bar.component.html
@@ -19,7 +19,7 @@
Charter