feat: filtering options for each podcast section (close #50)
All checks were successful
repod / xml (push) Successful in 32s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Successful in 2m36s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-01-29 23:33:05 +01:00
parent 99fa123640
commit ac4161a18a
10 changed files with 184 additions and 48 deletions

View File

@ -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",

View File

@ -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",

View File

@ -2,7 +2,7 @@
<div>
<Loading v-if="loading" />
<ul v-if="!loading">
<NcListItem v-for="episode in episodes"
<NcListItem v-for="episode in filteredEpisodes"
:key="episode.guid"
:active="isCurrentEpisode(episode)"
:class="hasEnded(episode) ? 'ended': ''"
@ -20,7 +20,7 @@
{{ episode.duration }}
</template>
<template #indicator>
<NcProgressBar v-if="episode.action && episode.action.action === 'PLAY'"
<NcProgressBar v-if="isListening(episode)"
class="progress"
:value="episode.action.position * 100 / episode.action.total" />
</template>
@ -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)
},

View File

@ -15,7 +15,7 @@
<VolumeMute v-if="player.volume === 0"
class="pointer"
:size="30"
@click="unmute" />
@click="$store.dispatch('player/volume', volumeMuted)" />
<input max="1"
min="0"
step="0.1"
@ -54,9 +54,6 @@ export default {
this.volumeMuted = this.player.volume
this.$store.dispatch('player/volume', 0)
},
unmute() {
this.$store.dispatch('player/volume', this.volumeMuted)
},
},
}
</script>

View File

@ -0,0 +1,51 @@
<template>
<NcAppNavigationItem :allow-collapse="true" :name="t('repod', 'Filtering episodes')">
<template #icon>
<FilterIcon v-if="all" :size="20" />
<FilterSettings v-if="!all" :size="20" />
</template>
<template #actions>
<NcActionCheckbox :checked="all"
:disabled="all"
@update:checked="(checked) => $store.commit('settings/filters', { listened: checked, listening: checked, unlistened: checked })">
{{ t('repod', 'Show all') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.listened"
@update:checked="(checked) => $store.commit('settings/filters', { listened: checked })">
{{ t('repod', 'Listened') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.listening"
@update:checked="(checked) => $store.commit('settings/filters', { listening: checked })">
{{ t('repod', 'Listening') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.unlistened"
@update:checked="(checked) => $store.commit('settings/filters', { unlistened: checked })">
{{ t('repod', 'Unlistened') }}
</NcActionCheckbox>
</template>
</NcAppNavigationItem>
</template>
<script>
import { NcActionCheckbox, NcAppNavigationItem } from '@nextcloud/vue'
import FilterIcon from 'vue-material-design-icons/Filter.vue'
import FilterSettings from 'vue-material-design-icons/FilterSettings.vue'
export default {
name: 'Filters',
components: {
FilterIcon,
FilterSettings,
NcAppNavigationItem,
NcActionCheckbox,
},
computed: {
all() {
return this.filters.listened && this.filters.listening && this.filters.unlistened
},
filters() {
return this.$store.state.settings.filters
},
},
}
</script>

View File

@ -19,6 +19,7 @@
</template>
<template #footer>
<NcAppNavigationSettings>
<Filters />
<Speed />
<Import />
<Export />
@ -31,6 +32,7 @@
import { NcAppContentList, NcAppNavigationNew, NcAppNavigationSettings } from '@nextcloud/vue'
import AppNavigation from '../Atoms/AppNavigation.vue'
import Export from '../Settings/Export.vue'
import Filters from '../Settings/Filters.vue'
import Import from '../Settings/Import.vue'
import Item from './Item.vue'
import Loading from '../Atoms/Loading.vue'
@ -43,6 +45,7 @@ export default {
components: {
AppNavigation,
Export,
Filters,
Import,
Item,
Loading,

View File

@ -1,6 +1,7 @@
import Vuex, { Store } from 'vuex'
import Vue from 'vue'
import { player } from './player.js'
import { settings } from './settings.js'
import { subscriptions } from './subscriptions.js'
Vue.use(Vuex)
@ -8,6 +9,7 @@ Vue.use(Vuex)
const store = new Store({
modules: {
player,
settings,
subscriptions,
},
})

15
src/store/settings.js Normal file
View File

@ -0,0 +1,15 @@
export const settings = {
namespaced: true,
state: {
filters: {
listened: true,
listening: true,
unlistened: true,
},
},
mutations: {
filters: (state, filters) => {
state.filters = { ...state.filters, ...filters }
},
},
}

View File

@ -86,14 +86,23 @@ msgstr "Arrêter"
msgid "Could not fetch episodes"
msgstr "Impossible de récuprer les épisodes"
msgid "Are you sure you want to delete this subscription?"
msgstr "Êtes-vous sûr de vouloir supprimer ce flux ?"
msgid "Export subscriptions"
msgstr "Exporter les abonnements"
msgid "Error while removing the feed"
msgstr "Erreur lors de la suppression du flux"
msgid "Filtering episodes"
msgstr "Filtrage des épisodes"
msgid "Playback speed"
msgstr "Vitesse de lecture"
msgid "Show all"
msgstr "Montrer tout"
msgid "Listened"
msgstr "Écoutés"
msgid "Listening"
msgstr "En cours"
msgid "Unlistened"
msgstr "Non lus"
msgid "Import subscriptions"
msgstr "Importer les abonnements"
@ -101,8 +110,14 @@ msgstr "Importer les abonnements"
msgid "Import OPML file"
msgstr "Importer un fichier OPML"
msgid "Export subscriptions"
msgstr "Exporter les abonnements"
msgid "Playback speed"
msgstr "Vitesse de lecture"
msgid "Are you sure you want to delete this subscription?"
msgstr "Êtes-vous sûr de vouloir supprimer ce flux ?"
msgid "Error while removing the feed"
msgstr "Erreur lors de la suppression du flux"
msgid "Add a podcast"
msgstr "Ajouter un podcast"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-21 11:14+0000\n"
"POT-Creation-Date: 2024-01-29 22:30+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -100,49 +100,69 @@ msgid "Could not fetch episodes"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:14
msgid "Are you sure you want to delete this subscription?"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Playback speed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Import subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Import OPML file"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Export subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Filtering episodes"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Show all"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Listened"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Listening"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Unlistened"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:20
msgid "Add a podcast"
msgid "Import subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:21
msgid "Could not fetch subscriptions"
msgid "Import OPML file"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:22
msgid "Find a podcast"
msgid "Playback speed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:23
msgid "Error loading feed"
msgid "Are you sure you want to delete this subscription?"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:24
msgid "Missing required app"
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:25
msgid "Add a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:26
msgid "Could not fetch subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:27
msgid "Find a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:28
msgid "Error loading feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:29
msgid "Missing required app"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:30
msgid "Install GPodder Sync"
msgstr ""