From ac4161a18a411988c3ba45d288b9a8f2ce298497 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Mon, 29 Jan 2024 23:33:05 +0100 Subject: [PATCH] feat: filtering options for each podcast section (close #50) --- l10n/fr.js | 13 +++-- l10n/fr.json | 13 +++-- src/components/Feed/Episodes.vue | 27 ++++++++- src/components/Player/Volume.vue | 5 +- src/components/Settings/Filters.vue | 51 +++++++++++++++++ src/components/Sidebar/Subscriptions.vue | 3 + src/store/main.js | 2 + src/store/settings.js | 15 +++++ translationfiles/fr/repod.po | 31 +++++++--- translationfiles/templates/repod.pot | 72 +++++++++++++++--------- 10 files changed, 184 insertions(+), 48 deletions(-) create mode 100644 src/components/Settings/Filters.vue create mode 100644 src/store/settings.js diff --git a/l10n/fr.js b/l10n/fr.js index c0d3870..c612501 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -19,12 +19,17 @@ OC.L10N.register( "Play" : "Lecture", "Stop" : "Arrêter", "Could not fetch episodes" : "Impossible de récuprer les épisodes", - "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", - "Error while removing the feed" : "Erreur lors de la suppression du flux", - "Playback speed" : "Vitesse de lecture", + "Export subscriptions" : "Exporter les abonnements", + "Filtering episodes" : "Filtrage des épisodes", + "Show all" : "Montrer tout", + "Listened" : "Écoutés", + "Listening" : "En cours", + "Unlistened" : "Non lus", "Import subscriptions" : "Importer les abonnements", "Import OPML file" : "Importer un fichier OPML", - "Export subscriptions" : "Exporter les abonnements", + "Playback speed" : "Vitesse de lecture", + "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", + "Error while removing the feed" : "Erreur lors de la suppression du flux", "Add a podcast" : "Ajouter un podcast", "Could not fetch subscriptions" : "Impossible de récupérer les flux", "Find a podcast" : "Chercher un podcast", diff --git a/l10n/fr.json b/l10n/fr.json index 1e8a4e4..0894ebd 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -17,12 +17,17 @@ "Play" : "Lecture", "Stop" : "Arrêter", "Could not fetch episodes" : "Impossible de récuprer les épisodes", - "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", - "Error while removing the feed" : "Erreur lors de la suppression du flux", - "Playback speed" : "Vitesse de lecture", + "Export subscriptions" : "Exporter les abonnements", + "Filtering episodes" : "Filtrage des épisodes", + "Show all" : "Montrer tout", + "Listened" : "Écoutés", + "Listening" : "En cours", + "Unlistened" : "Non lus", "Import subscriptions" : "Importer les abonnements", "Import OPML file" : "Importer un fichier OPML", - "Export subscriptions" : "Exporter les abonnements", + "Playback speed" : "Vitesse de lecture", + "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", + "Error while removing the feed" : "Erreur lors de la suppression du flux", "Add a podcast" : "Ajouter un podcast", "Could not fetch subscriptions" : "Impossible de récupérer les flux", "Find a podcast" : "Chercher un podcast", diff --git a/src/components/Feed/Episodes.vue b/src/components/Feed/Episodes.vue index a04b11c..29a1d48 100644 --- a/src/components/Feed/Episodes.vue +++ b/src/components/Feed/Episodes.vue @@ -2,7 +2,7 @@
    - @@ -88,6 +88,26 @@ export default { currentEpisode() { return this.$store.state.player.episode }, + filters() { + return this.$store.state.settings.filters + }, + filteredEpisodes() { + return this.episodes.filter((episode) => { + if (!this.filters.listened && this.hasEnded(episode)) { + return false + } + + if (!this.filters.listening && this.isListening(episode)) { + return false + } + + if (!this.filters.unlistened && !this.hasEnded(episode) && !this.isListening(episode)) { + return false + } + + return true + }) + }, url() { return decodeUrl(this.$route.params.url) }, @@ -116,6 +136,9 @@ export default { isCurrentEpisode(episode) { return this.currentEpisode && this.currentEpisode.url === episode.url }, + isListening(episode) { + return episode.action && episode.action.action === 'PLAY' && !this.hasEnded(episode) + }, load(episode) { this.$store.dispatch('player/load', episode) }, diff --git a/src/components/Player/Volume.vue b/src/components/Player/Volume.vue index 524ce80..3cddcea 100644 --- a/src/components/Player/Volume.vue +++ b/src/components/Player/Volume.vue @@ -15,7 +15,7 @@ + @click="$store.dispatch('player/volume', volumeMuted)" /> diff --git a/src/components/Settings/Filters.vue b/src/components/Settings/Filters.vue new file mode 100644 index 0000000..14ac319 --- /dev/null +++ b/src/components/Settings/Filters.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/components/Sidebar/Subscriptions.vue b/src/components/Sidebar/Subscriptions.vue index 1a4919c..0d2942d 100644 --- a/src/components/Sidebar/Subscriptions.vue +++ b/src/components/Sidebar/Subscriptions.vue @@ -19,6 +19,7 @@