diff --git a/src/lib/components/views/PlaylistManagerView.svelte b/src/lib/components/views/PlaylistManagerView.svelte index 2f6a80824..ddb96978a 100644 --- a/src/lib/components/views/PlaylistManagerView.svelte +++ b/src/lib/components/views/PlaylistManagerView.svelte @@ -39,7 +39,7 @@ } type PlaylistFilter = 'all' | 'visible' | 'hidden' | 'offline_all' | 'offline_partial' | 'offline_unavailable'; - type PlaylistSort = 'name' | 'recent' | 'playcount' | 'custom'; + type PlaylistSort = 'name' | 'recent' | 'playcount' | 'tracks' | 'custom'; type ViewMode = 'list' | 'grid'; interface Props { @@ -175,6 +175,12 @@ const countB = playlistStats.get(b.id)?.play_count ?? 0; return countB - countA; }); + } else if (sort === 'tracks') { + result.sort((a, b) => { + const countA = getTotalTrackCount(a); + const countB = getTotalTrackCount(b); + return countB - countA; + }); } else if (sort === 'custom') { result.sort((a, b) => { const posA = playlistSettings.get(a.id)?.position ?? 999; @@ -491,7 +497,7 @@ {#if showSortMenu} @@ -505,6 +511,9 @@ +