Skip to content

Commit

Permalink
Update:Persist podcast episode table sort and filter options in local…
Browse files Browse the repository at this point in the history
… storage #1321
  • Loading branch information
advplyr committed Nov 19, 2024
1 parent 22f85d3 commit ee6e2d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/components/tables/podcast/LazyEpisodesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
</template>
</div>
</div>
<!-- <p v-if="!episodes.length" class="py-4 text-center text-lg">{{ $strings.MessageNoEpisodes }}</p> -->
<div v-if="episodes.length" class="w-full py-3 mx-auto flex">
<form @submit.prevent="submit" class="flex flex-grow">
<ui-text-input v-model="search" @input="inputUpdate" type="search" :placeholder="$strings.PlaceholderSearchEpisode" class="flex-grow mr-2 text-sm md:text-base" />
Expand Down Expand Up @@ -515,6 +514,10 @@ export default {
}
},
filterSortChanged() {
// Save filterKey and sortKey to local storage
localStorage.setItem('podcastEpisodesFilter', this.filterKey)
localStorage.setItem('podcastEpisodesSortBy', this.sortKey + (this.sortDesc ? '-desc' : ''))
this.init()
},
refresh() {
Expand All @@ -537,6 +540,11 @@ export default {
}
},
mounted() {
this.filterKey = localStorage.getItem('podcastEpisodesFilter') || 'incomplete'
const sortBy = localStorage.getItem('podcastEpisodesSortBy') || 'publishedAt-desc'
this.sortKey = sortBy.split('-')[0]
this.sortDesc = sortBy.split('-')[1] === 'desc'
this.episodesCopy = this.episodes.map((ep) => ({ ...ep }))
this.initListeners()
this.init()
Expand Down

0 comments on commit ee6e2d2

Please sign in to comment.