From f2dab9f6e119989fa40d25833d88f899a60eb4f7 Mon Sep 17 00:00:00 2001 From: omgbeez <251408589+omgbeez@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:01:19 -0500 Subject: [PATCH 1/3] Update default sort field to 'added' and direction to 'desc' in torrent table component --- client/src/app/torrent-table/torrent-table.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index da7478f..3701477 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -21,8 +21,8 @@ export class TorrentTableComponent implements OnInit { public torrents: Torrent[] = []; public selectedTorrents: string[] = []; public error: string; - public sortProperty = 'rdName'; - public sortDirection: 'asc' | 'desc' = 'asc'; + public sortProperty = 'added'; + public sortDirection: 'asc' | 'desc' = 'desc'; public isDeleteModalActive: boolean; public deleteError: string; From 3eda321d64ec95806e90b4292527748d903b7d04 Mon Sep 17 00:00:00 2001 From: omgbeez <251408589+omgbeez@users.noreply.github.com> Date: Fri, 20 Feb 2026 14:42:38 -0500 Subject: [PATCH 2/3] Make sort settings persistent. --- .../torrent-table/torrent-table.component.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index 3701477..9125930 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -57,6 +57,20 @@ export class TorrentTableComponent implements OnInit { ) {} ngOnInit(): void { + // Load persisted sort settings (if any) + try { + const sp = localStorage.getItem('torrentTable.sortProperty'); + const sd = localStorage.getItem('torrentTable.sortDirection'); + if (sp) { + this.sortProperty = sp; + } + if (sd === 'asc' || sd === 'desc') { + this.sortDirection = sd as 'asc' | 'desc'; + } + } catch (_) { + // Ignore storage errors (e.g., disabled storage) + } + this.torrentService.getDiskSpaceStatus().subscribe({ next: (status) => { this.diskSpaceStatus = status; @@ -82,8 +96,17 @@ export class TorrentTableComponent implements OnInit { } public sort(property: string): void { + const isSameProperty = this.sortProperty === property; this.sortProperty = property; - this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc'; + this.sortDirection = isSameProperty ? (this.sortDirection === 'asc' ? 'desc' : 'asc') : this.sortDirection; + + // Persist sort settings + try { + localStorage.setItem('torrentTable.sortProperty', this.sortProperty); + localStorage.setItem('torrentTable.sortDirection', this.sortDirection); + } catch (_) { + // Ignore storage errors + } } public openTorrent(torrentId: string): void { From 6dedb621d13ee2eaaeb5dc627848d7d7a521101b Mon Sep 17 00:00:00 2001 From: omgbeez <251408589+omgbeez@users.noreply.github.com> Date: Fri, 20 Feb 2026 16:09:56 -0500 Subject: [PATCH 3/3] Fix sorting logic to default to descending order for new properties --- client/src/app/torrent-table/torrent-table.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index 9125930..c19c8c0 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -96,9 +96,12 @@ export class TorrentTableComponent implements OnInit { } public sort(property: string): void { - const isSameProperty = this.sortProperty === property; - this.sortProperty = property; - this.sortDirection = isSameProperty ? (this.sortDirection === 'asc' ? 'desc' : 'asc') : this.sortDirection; + if (this.sortProperty === property) { + this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc'; + } else { + this.sortProperty = property; + this.sortDirection = 'desc'; + } // Persist sort settings try {