mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-25 05:04:30 +02:00
Add:Podcast latest page
This commit is contained in:
parent
ab9f7fed64
commit
af9a7aafae
2 changed files with 53 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full h-full">
|
<div class="w-full h-full">
|
||||||
<home-bookshelf-nav-bar />
|
<home-bookshelf-nav-bar />
|
||||||
<home-bookshelf-toolbar v-show="!isHome" />
|
<home-bookshelf-toolbar v-show="!isHome && !isLatest" />
|
||||||
<div id="bookshelf-wrapper" class="main-content overflow-y-auto overflow-x-hidden relative" :class="isHome ? 'home-page' : ''">
|
<div id="bookshelf-wrapper" class="main-content overflow-y-auto overflow-x-hidden relative" :class="isHome ? 'home-page' : ''">
|
||||||
<nuxt-child />
|
<nuxt-child />
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
isHome() {
|
isHome() {
|
||||||
return this.$route.name === 'bookshelf'
|
return this.$route.name === 'bookshelf'
|
||||||
|
},
|
||||||
|
isLatest() {
|
||||||
|
return this.$route.name === 'bookshelf-latest'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,59 @@
|
||||||
<template>
|
<template>
|
||||||
<div>Latest</div>
|
<div class="w-full p-4">
|
||||||
|
<h1 class="text-xl mb-2 font-semibold">Latest Episodes</h1>
|
||||||
|
|
||||||
|
<template v-for="episode in recentEpisodes">
|
||||||
|
<tables-podcast-episode-row :episode="episode" :local-episode="localEpisodeMap[episode.id]" :library-item-id="episode.libraryItemId" :local-library-item-id="null" :is-local="isLocal" :key="episode.id" @addToPlaylist="addEpisodeToPlaylist" />
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
processing: false,
|
||||||
|
recentEpisodes: [],
|
||||||
|
totalEpisodes: 0,
|
||||||
|
currentPage: 0,
|
||||||
|
localEpisodeMap: {},
|
||||||
|
isLocal: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {},
|
watch: {},
|
||||||
computed: {},
|
computed: {
|
||||||
methods: {}
|
currentLibraryId() {
|
||||||
|
return this.$store.state.libraries.currentLibraryId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async addEpisodeToPlaylist(episode) {
|
||||||
|
const libraryItem = await this.$axios.$get(`/api/items/${episode.libraryItemId}`).catch((error) => {
|
||||||
|
console.error('Failed to get library item', error)
|
||||||
|
this.$toast.error('Failed to get library item')
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
if (!libraryItem) return
|
||||||
|
|
||||||
|
this.$store.commit('globals/setSelectedPlaylistItems', [{ libraryItem, episode }])
|
||||||
|
this.$store.commit('globals/setShowPlaylistsAddCreateModal', true)
|
||||||
|
},
|
||||||
|
async loadRecentEpisodes(page = 0) {
|
||||||
|
this.processing = true
|
||||||
|
const episodePayload = await this.$axios.$get(`/api/libraries/${this.currentLibraryId}/recent-episodes?limit=25&page=${page}`).catch((error) => {
|
||||||
|
console.error('Failed to get recent episodes', error)
|
||||||
|
this.$toast.error('Failed to get recent episodes')
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
this.processing = false
|
||||||
|
console.log('Episodes', episodePayload)
|
||||||
|
this.recentEpisodes = episodePayload.episodes || []
|
||||||
|
this.totalEpisodes = episodePayload.total
|
||||||
|
this.currentPage = page
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.loadRecentEpisodes()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue