Rework sidebar

This commit is contained in:
Geomitron
2023-12-20 18:20:27 -06:00
parent 742c6a28d0
commit 0a83ea3937
16 changed files with 846 additions and 150 deletions

View File

@@ -7,3 +7,5 @@
<td>{{ song[0].artist }}</td>
<td>{{ song[0].album || 'Various' }}</td>
<td>{{ song[0].genre || 'Various' }}</td>
<td>{{ song[0].year || 'Various' }}</td>
<!-- TODO: "Various" will never display -->

View File

@@ -11,6 +11,7 @@
<th [class.sorted]="sortColumn === 'artist'" [ngClass]="sortDirection" (click)="onColClicked('artist')">Artist</th>
<th [class.sorted]="sortColumn === 'album'" [ngClass]="sortDirection" (click)="onColClicked('album')">Album</th>
<th [class.sorted]="sortColumn === 'genre'" [ngClass]="sortDirection" (click)="onColClicked('genre')">Genre</th>
<th [class.sorted]="sortColumn === 'year'" [ngClass]="sortDirection" (click)="onColClicked('year')">Year</th>
</tr>
</thead>
<tbody>

View File

@@ -23,7 +23,7 @@ export class ResultTableComponent implements OnInit {
activeSong: ChartData[] | null = null
sortDirection: 'ascending' | 'descending' = 'descending'
sortColumn: 'name' | 'artist' | 'album' | 'genre' | null = null
sortColumn: 'name' | 'artist' | 'album' | 'genre' | 'year' | null = null
constructor(
public searchService: SearchService,
@@ -49,7 +49,7 @@ export class ResultTableComponent implements OnInit {
}
}
onColClicked(column: 'name' | 'artist' | 'album' | 'genre') {
onColClicked(column: 'name' | 'artist' | 'album' | 'genre' | 'year') {
if (this.songs.length === 0) { return }
if (this.sortColumn !== column) {
this.sortColumn = column