diff --git a/client/components/modals/podcast/EpisodeFeed.vue b/client/components/modals/podcast/EpisodeFeed.vue index 2648c522..08f2f38c 100644 --- a/client/components/modals/podcast/EpisodeFeed.vue +++ b/client/components/modals/podcast/EpisodeFeed.vue @@ -10,6 +10,12 @@
+ + {{ $strings.LabelSortPubDate }} + + {{ sortDescending ? 'expand_more' : 'expand_less' }} + +
@@ -73,7 +79,8 @@ export default { searchTimeout: null, searchText: null, downloadedEpisodeGuidMap: {}, - downloadedEpisodeUrlMap: {} + downloadedEpisodeUrlMap: {}, + sortDescending: true } }, watch: { @@ -141,6 +148,17 @@ export default { } }, methods: { + toggleSort() { + this.sortDescending = !this.sortDescending + this.episodesCleaned = this.episodesCleaned.toSorted((a, b) => { + if (this.sortDescending) { + return a.publishedAt < b.publishedAt ? 1 : -1 + } + return a.publishedAt > b.publishedAt ? 1 : -1 + }) + this.selectedEpisodes = {} + this.selectAll = false + }, getIsEpisodeDownloaded(episode) { if (episode.guid && !!this.downloadedEpisodeGuidMap[episode.guid]) { return true diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 636e3019..ef43d4f5 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -604,6 +604,7 @@ "LabelSlug": "Slug", "LabelSortAscending": "Ascending", "LabelSortDescending": "Descending", + "LabelSortPubDate": "Sort Pub Date", "LabelStart": "Start", "LabelStartTime": "Start Time", "LabelStarted": "Started",