mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Add configurable columns
This commit is contained in:
@@ -4,8 +4,11 @@
|
||||
<td>
|
||||
<span *ngIf="song.length > 1" class="rounded-sm bg-accent text-accent-content px-1 mr-1 font-bold">{{ song.length }}</span> {{ song[0].name }}
|
||||
</td>
|
||||
<td>{{ song[0].artist }}</td>
|
||||
<td>{{ song[0].album || 'Various' }}</td>
|
||||
<td>{{ song[0].genre || 'Various' }}</td>
|
||||
<td>{{ song[0].year || 'Various' }}</td>
|
||||
<td *ngIf="hasColumn('artist')">{{ song[0].artist }}</td>
|
||||
<td *ngIf="hasColumn('album')">{{ song[0].album || 'Various' }}</td>
|
||||
<td *ngIf="hasColumn('genre')">{{ song[0].genre || 'Various' }}</td>
|
||||
<td *ngIf="hasColumn('year')">{{ song[0].year || 'Various' }}</td>
|
||||
<td *ngIf="hasColumn('charter')">{{ song[0].charter || 'Various' }}</td>
|
||||
<td *ngIf="hasColumn('length')">{{ songLength }}</td>
|
||||
<td *ngIf="hasColumn('difficulty')">{{ songDifficulty }}</td>
|
||||
<!-- TODO: "Various" will never display -->
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
|
||||
|
||||
import { ChartData } from '../../../../../../src-shared/interfaces/search.interface'
|
||||
import { SelectionService } from '../../../../core/services/selection.service'
|
||||
import { SearchService } from 'src-angular/app/core/services/search.service.js'
|
||||
import { SettingsService } from 'src-angular/app/core/services/settings.service.js'
|
||||
|
||||
import { ChartData } from '../../../../../../src-shared/interfaces/search.interface.js'
|
||||
import { msToRoughTime } from '../../../../../../src-shared/UtilFunctions.js'
|
||||
import { SelectionService } from '../../../../core/services/selection.service.js'
|
||||
|
||||
@Component({
|
||||
selector: 'tr[app-result-table-row]',
|
||||
@@ -12,7 +16,11 @@ export class ResultTableRowComponent implements OnInit {
|
||||
|
||||
@Output() rowFocused: EventEmitter<string> = new EventEmitter()
|
||||
|
||||
constructor(private selectionService: SelectionService) { }
|
||||
constructor(
|
||||
private selectionService: SelectionService,
|
||||
private searchService: SearchService,
|
||||
private settingsService: SettingsService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.selectionService.selections[this.groupId] = this.selectionService.isAllSelected()
|
||||
@@ -22,6 +30,30 @@ export class ResultTableRowComponent implements OnInit {
|
||||
return this.song[0].groupId
|
||||
}
|
||||
|
||||
hasColumn(column: string) {
|
||||
return this.settingsService.visibleColumns.includes(column)
|
||||
}
|
||||
|
||||
get songLength() {
|
||||
return msToRoughTime(this.song[0].notesData.effectiveLength)
|
||||
}
|
||||
|
||||
get songDifficulty() {
|
||||
switch (this.searchService.instrument.value) {
|
||||
case 'guitar': return this.song[0].diff_guitar ?? '?'
|
||||
case 'guitarcoop': return this.song[0].diff_guitar_coop ?? '?'
|
||||
case 'rhythm': return this.song[0].diff_rhythm ?? '?'
|
||||
case 'bass': return this.song[0].diff_bass ?? '?'
|
||||
case 'drums': return this.song[0].diff_drums ?? '?'
|
||||
case 'keys': return this.song[0].diff_keys ?? '?'
|
||||
case 'guitarghl': return this.song[0].diff_guitarghl ?? '?'
|
||||
case 'guitarcoopghl': return this.song[0].diff_guitar_coop_ghl ?? '?'
|
||||
case 'rhythmghl': return this.song[0].diff_rhythm_ghl ?? '?'
|
||||
case 'bassghl': return this.song[0].diff_bassghl ?? '?'
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
|
||||
get selected() {
|
||||
return this.selectionService.selections[this.groupId] ?? false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user