Show the filter control only for the serial podcast type

This commit is contained in:
mfcar 2024-03-02 21:55:27 +00:00
parent 090ba90b37
commit 2f97499612
No known key found for this signature in database

View file

@ -18,7 +18,9 @@
<ui-btn :disabled="processing" small class="ml-2 h-9" @click="clearSelected">{{ $strings.ButtonCancel }}</ui-btn> <ui-btn :disabled="processing" small class="ml-2 h-9" @click="clearSelected">{{ $strings.ButtonCancel }}</ui-btn>
</template> </template>
<template v-else> <template v-else>
<template v-if="podcastType === 'serial'">
<controls-filter-select v-model="seasonKey" :items="seasonItems" class="w-36 h-9 md:ml-4" @change="filterSortChanged" /> <controls-filter-select v-model="seasonKey" :items="seasonItems" class="w-36 h-9 md:ml-4" @change="filterSortChanged" />
</template>
<controls-filter-select v-model="filterKey" :items="filterItems" class="w-36 h-9 md:ml-4" @change="filterSortChanged" /> <controls-filter-select v-model="filterKey" :items="filterItems" class="w-36 h-9 md:ml-4" @change="filterSortChanged" />
<controls-sort-select v-model="sortKey" :descending.sync="sortDesc" :items="sortItems" class="w-44 md:w-48 h-9 ml-1 sm:ml-4" @change="filterSortChanged" /> <controls-sort-select v-model="sortKey" :descending.sync="sortDesc" :items="sortItems" class="w-44 md:w-48 h-9 ml-1 sm:ml-4" @change="filterSortChanged" />
<div class="flex-grow md:hidden" /> <div class="flex-grow md:hidden" />
@ -34,6 +36,9 @@
</div> </div>
<!-- <div>--> <!-- <div>-->
<!-- <pre>{{ episodesList }}</pre>--> <!-- <pre>{{ episodesList }}</pre>-->
<!-- </div>-->
<!-- <div>-->
<!-- <pre>{{ libraryItem }}</pre>-->
<!-- </div>--> <!-- </div>-->
<div class="relative min-h-[176px]"> <div class="relative min-h-[176px]">
<template v-for="episode in totalEpisodes"> <template v-for="episode in totalEpisodes">
@ -184,6 +189,9 @@ export default {
mediaMetadata() { mediaMetadata() {
return this.media.metadata || {} return this.media.metadata || {}
}, },
podcastType() {
return this.mediaMetadata.type || 'episodic'
},
episodes() { episodes() {
return this.media.episodes || [] return this.media.episodes || []
}, },
@ -191,7 +199,7 @@ export default {
return this.episodesCopy return this.episodesCopy
.filter((ep) => { .filter((ep) => {
// Filter by season // Filter by season
if (this.seasonKey !== 'allSeasons' && ep.season !== this.seasonKey) return false if (this.podcastType === 'serial' && this.seasonKey !== 'allSeasons' && ep.season !== this.seasonKey) return false
if (this.filterKey === 'all') return true if (this.filterKey === 'all') return true
const episodeProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItem.id, ep.id) const episodeProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItem.id, ep.id)