Fix sorting

This commit is contained in:
aditya.chandel
2025-06-06 16:37:19 -06:00
parent 6fef5344d5
commit 7053cfa963
2 changed files with 9 additions and 4 deletions
@@ -670,14 +670,20 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
}; };
const userSortKey = effectivePrefs.sortKey; const userSortKey = effectivePrefs.sortKey;
const userSortDir = effectivePrefs.sortDir?.toUpperCase() === 'DESC'
? SortDirection.DESCENDING
: SortDirection.ASCENDING;
const matchedSort = this.sortOptions.find(opt => opt.field === userSortKey) || this.sortOptions.find(opt => opt.field === sortParam); const matchedSort = this.sortOptions.find(opt => opt.field === userSortKey) || this.sortOptions.find(opt => opt.field === sortParam);
this.selectedSort = matchedSort ? { this.selectedSort = matchedSort ? {
label: matchedSort.label, label: matchedSort.label,
field: matchedSort.field, field: matchedSort.field,
direction: directionParam?.toUpperCase() === SORT_DIRECTION.DESCENDING direction: userSortDir ?? (
? SortDirection.DESCENDING directionParam?.toUpperCase() === SORT_DIRECTION.DESCENDING
: SortDirection.ASCENDING ? SortDirection.DESCENDING
: SortDirection.ASCENDING
)
} : { } : {
label: 'Added On', label: 'Added On',
field: 'addedOn', field: 'addedOn',
@@ -113,7 +113,6 @@ export class PdfViewerComponent implements OnInit, OnDestroy {
onPdfPagesLoaded(event: any): void { onPdfPagesLoaded(event: any): void {
this.totalPages = event.pagesCount; this.totalPages = event.pagesCount;
console.log('Total pages loaded:', this.totalPages);
} }
ngOnDestroy(): void { ngOnDestroy(): void {