This commit is contained in:
Greg Lorenzen 2026-02-26 10:57:41 +01:00 committed by GitHub
commit 0a97484f08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 142 additions and 6 deletions

View file

@ -1,7 +1,39 @@
<template>
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar :selected-series="series" />
<app-lazy-bookshelf page="series-books" :series-id="seriesId" />
<div id="page-wrapper" class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar id="series-toolbar" :selected-series="series" />
<div class="h-full overflow-y-auto pb-[100px]">
<div class="max-w-6xl mx-auto">
<div class="px-4e sm:px-8e">
<div class="flex items-center my-8">
<h1 class="text-2xl">{{ series.name }}</h1>
<button class="w-8 h-8 rounded-full flex items-center justify-center mx-4 cursor-pointer text-gray-300 hover:text-warning transform hover:scale-125 duration-100" @click="showEditSeries">
<span class="material-symbols text-base">edit</span>
</button>
</div>
<div class="mb-6">
<h2 class="font-semibold">
{{ $strings.LabelDescription }}
</h2>
<div>{{ series.description }}</div>
</div>
<div class="mb-6">
<h2 class="font-semibold">
{{ authors.length > 1 ? $strings.LabelAuthors : $strings.LabelAuthor }}
</h2>
<div>{{ authors.join(', ') }}</div>
</div>
<div class="mb-6">
<h2 class="font-semibold">{{ this.$strings.LabelTotalDuration }}</h2>
<div>{{ totalDuration.hours }}<span>hrs</span> {{ totalDuration.minutes }}<span>min</span></div>
</div>
</div>
<app-lazy-bookshelf page="series-books" :series-id="seriesId" />
</div>
</div>
<modals-edit-series-modal v-model="showEditSeriesModal" :series="series" />
</div>
</template>
@ -19,7 +51,7 @@ export default {
return redirect(`/library/${libraryId}`)
}
const series = await app.$axios.$get(`/api/libraries/${library.id}/series/${params.id}?include=progress,rssfeed`).catch((error) => {
const series = await app.$axios.$get(`/api/libraries/${library.id}/series/${params.id}?include=progress,rssfeed&expanded=1`).catch((error) => {
console.error('Failed', error)
return false
})
@ -33,16 +65,37 @@ export default {
}
},
data() {
return {}
return {
showEditSeriesModal: false
}
},
computed: {
streamLibraryItem() {
return this.$store.state.streamLibraryItem
},
totalDuration() {
const totalSeconds = this.series.books.reduce((acc, book) => acc + book.duration, 0)
const hours = Math.floor(totalSeconds / 3600)
const minuteRemainder = totalSeconds % 3600
const minutes = Math.floor(minuteRemainder / 60)
return { hours, minutes }
},
authors() {
// Get nested array of authors
const nestedAuthors = this.series.books.map((book) => book.authors.map((author) => author.name))
// Flatten to one array
const authors = nestedAuthors.flat(1)
// Remove duplicates
return [...new Set(authors)]
}
},
methods: {
seriesUpdated(series) {
this.series = series
},
showEditSeries() {
this.showEditSeriesModal = !this.showEditSeriesModal
}
},
mounted() {
@ -57,3 +110,12 @@ export default {
}
}
</script>
<style scoped>
#bookshelf {
background-image: none;
}
#series-toolbar {
background-color: rgba(55, 56, 56, 1);
}
</style>