Add "Upload Date" column

This commit is contained in:
Geomitron
2025-02-08 12:19:24 -06:00
parent deaa7d22be
commit c9166966c1
7 changed files with 18 additions and 3 deletions

View File

@@ -11,3 +11,4 @@
<td *ngIf="hasColumn('charter')">{{ song[0].charter || 'Various' }}</td>
<td *ngIf="hasColumn('length')">{{ songLength }}</td>
<td *ngIf="hasColumn('difficulty')">{{ songDifficulty }}</td>
<td *ngIf="hasColumn('uploaded')" class="text-nowrap">{{ uploaded | date: 'yyyy-MM-dd' }}</td>

View File

@@ -54,6 +54,10 @@ export class ResultTableRowComponent implements OnInit {
}
}
get uploaded() {
return this.song[0].modifiedTime
}
get selected() {
return this.selectionService.selections[this.groupId] ?? false
}

View File

@@ -31,6 +31,9 @@
Length (min) <i *ngIf="sortColumn === 'length'" class="bi bi-caret-{{ sortDirection === 'asc' ? 'down' : 'up' }}-fill"></i>
</th>
<th *ngIf="hasColumn('difficulty')" [ngClass]="sortDirection" class="cursor-pointer">Difficulty</th>
<th *ngIf="hasColumn('uploaded')" [ngClass]="sortDirection" class="cursor-pointer" (click)="onColClicked('modifiedTime')">
Upload Date <i *ngIf="sortColumn === 'modifiedTime'" class="bi bi-caret-{{ sortDirection === 'asc' ? 'down' : 'up' }}-fill"></i>
</th>
</tr>
</thead>
<tbody>

View File

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

View File

@@ -218,6 +218,10 @@
<input id="difficultyColumn" type="checkbox" checked="checked" class="checkbox mr-1" [formControl]="difficultyColumn" />
Difficulty
</label>
<label class="label cursor-pointer" for="uploadedColumn">
<input id="uploadedColumn" type="checkbox" checked="checked" class="checkbox mr-1" [formControl]="uploadedColumn" />
Upload Date
</label>
</div>
</div>

View File

@@ -24,6 +24,7 @@ export class SettingsComponent implements OnInit {
public charterColumn: FormControl<boolean>
public lengthColumn: FormControl<boolean>
public difficultyColumn: FormControl<boolean>
public uploadedColumn: FormControl<boolean>
updateAvailable: 'yes' | 'no' | 'error' = 'no'
loginClicked = false
@@ -57,6 +58,7 @@ export class SettingsComponent implements OnInit {
this.charterColumn = new FormControl<boolean>(ss.visibleColumns.includes('charter'), { nonNullable: true })
this.lengthColumn = new FormControl<boolean>(ss.visibleColumns.includes('length'), { nonNullable: true })
this.difficultyColumn = new FormControl<boolean>(ss.visibleColumns.includes('difficulty'), { nonNullable: true })
this.uploadedColumn = new FormControl<boolean>(ss.visibleColumns.includes('uploaded'), { nonNullable: true })
this.artistColumn.valueChanges.subscribe(value => value ? ss.addVisibleColumn('artist') : ss.removeVisibleColumn('artist'))
this.albumColumn.valueChanges.subscribe(value => value ? ss.addVisibleColumn('album') : ss.removeVisibleColumn('album'))
@@ -66,6 +68,7 @@ export class SettingsComponent implements OnInit {
this.lengthColumn.valueChanges.subscribe(value => value ? ss.addVisibleColumn('length') : ss.removeVisibleColumn('length'))
this.difficultyColumn.valueChanges
.subscribe(value => value ? ss.addVisibleColumn('difficulty') : ss.removeVisibleColumn('difficulty'))
this.uploadedColumn.valueChanges.subscribe(value => value ? ss.addVisibleColumn('uploaded') : ss.removeVisibleColumn('uploaded'))
}
async ngOnInit() {

View File

@@ -34,7 +34,7 @@ export class SearchService {
public difficulty: FormControl<Difficulty | null>
public drumType: FormControl<DrumTypeName | null>
public sortDirection: 'asc' | 'desc' = 'asc'
public sortColumn: 'name' | 'artist' | 'album' | 'genre' | 'year' | 'charter' | 'length' | null = null
public sortColumn: 'name' | 'artist' | 'album' | 'genre' | 'year' | 'charter' | 'length' | 'modifiedTime' | null = null
constructor(
private http: HttpClient,