Fix result table layout

This commit is contained in:
Geomitron
2023-12-14 13:36:45 -06:00
parent c2e355cb53
commit 742c6a28d0
23 changed files with 81 additions and 196 deletions

View File

@@ -1,10 +1,8 @@
<td>
<div #checkbox class="ui checkbox" (click)="$event.stopPropagation()">
<input type="checkbox" />
</div>
<input #checkAllCheckbox type="checkbox" class="checkbox" (click)="$event.stopPropagation()" [(ngModel)]="selected" />
</td>
<td>
<span id="chartCount" *ngIf="song.length > 1">{{ song.length }}</span> {{ song[0].name }}
<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>

View File

@@ -1,10 +0,0 @@
.ui.checkbox {
display: block;
}
#chartCount {
background-color: lightgray;
border-radius: 3px;
padding: 1px 4px 2px 4px;
margin-right: 3px;
}

View File

@@ -1,4 +1,4 @@
import { AfterViewInit, Component, ElementRef, Input, ViewChild } from '@angular/core'
import { Component, Input, OnInit } from '@angular/core'
import { ChartData } from '../../../../../../src-shared/interfaces/search.interface'
import { SelectionService } from '../../../../core/services/selection.service'
@@ -6,36 +6,24 @@ import { SelectionService } from '../../../../core/services/selection.service'
@Component({
selector: 'tr[app-result-table-row]',
templateUrl: './result-table-row.component.html',
styleUrls: ['./result-table-row.component.scss'],
})
export class ResultTableRowComponent implements AfterViewInit {
export class ResultTableRowComponent implements OnInit {
@Input() song: ChartData[]
@ViewChild('checkbox', { static: true }) checkbox: ElementRef
constructor(private selectionService: SelectionService) { }
get songID() {
return this.song[0].songId ?? this.song[0].chartId
ngOnInit() {
this.selectionService.selections[this.groupId] = false
}
ngAfterViewInit() {
this.selectionService.onSelectionChanged(this.songID, isChecked => {
if (isChecked) {
// TODO
// $(this.checkbox.nativeElement).checkbox('check')
} else {
// $(this.checkbox.nativeElement).checkbox('uncheck')
}
})
get groupId() {
return this.song[0].groupId
}
// $(this.checkbox.nativeElement).checkbox({
// onChecked: () => {
// this.selectionService.selectSong(this.songID)
// },
// onUnchecked: () => {
// this.selectionService.deselectSong(this.songID)
// },
// })
get selected() {
return this.selectionService.selections[this.groupId] ?? false
}
set selected(value: boolean) {
this.selectionService.selections[this.groupId] = value
}
}