mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-02 18:14:47 +02:00
Add: Library list view
This commit is contained in:
parent
fd79baed61
commit
b6dd37b7f6
3 changed files with 30 additions and 8 deletions
|
@ -96,6 +96,7 @@ export default {
|
|||
|
||||
var bookshelfView = this.isListView ? 'list' : 'grid'
|
||||
this.$localStore.setBookshelfView(bookshelfView)
|
||||
this.$store.commit('setBookshelfView', bookshelfView)
|
||||
},
|
||||
updateOrder() {
|
||||
this.saveSettings()
|
||||
|
@ -113,7 +114,7 @@ export default {
|
|||
var bookshelfView = await this.$localStore.getBookshelfView()
|
||||
this.isListView = bookshelfView === 'list'
|
||||
this.bookshelfReady = true
|
||||
console.log('Bookshelf view', bookshelfView)
|
||||
this.$store.commit('setBookshelfView', bookshelfView)
|
||||
},
|
||||
settingsUpdated(settings) {
|
||||
for (const key in settings) {
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
<template>
|
||||
<div class="w-full h-full">
|
||||
<div class="w-full h-full" v-show="!isListView">
|
||||
<template v-for="(shelf, index) in shelves">
|
||||
<bookshelf-library-shelf :key="shelf.id" :books="shelf.books" :style="{ zIndex: shelves.length - index }" />
|
||||
</template>
|
||||
</div>
|
||||
<div class="w-full h-full px-4 py-2" v-show="isListView">
|
||||
<template v-for="book in books">
|
||||
<app-bookshelf-list-row :key="book.id" :audiobook="book" :page-width="pageWidth" class="my-2" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
booksPerRow: 3
|
||||
booksPerRow: 3,
|
||||
pageWidth: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
bookshelfView() {
|
||||
return this.$store.state.bookshelfView
|
||||
},
|
||||
isListView() {
|
||||
return this.bookshelfView === 'list'
|
||||
},
|
||||
books() {
|
||||
return this.$store.getters['audiobooks/getFilteredAndSorted']()
|
||||
},
|
||||
|
@ -37,12 +51,15 @@ export default {
|
|||
}
|
||||
}
|
||||
if (shelf.books.length) {
|
||||
shelf.id++
|
||||
shelves.push(shelf)
|
||||
}
|
||||
return shelves
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
mounted() {}
|
||||
mounted() {
|
||||
this.pageWidth = window.innerWidth
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -16,7 +16,8 @@ export const state = () => ({
|
|||
showReader: false,
|
||||
downloadFolder: null,
|
||||
mediaScanResults: {},
|
||||
showSideDrawer: false
|
||||
showSideDrawer: false,
|
||||
bookshelfView: 'grid'
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
|
@ -104,5 +105,8 @@ export const mutations = {
|
|||
},
|
||||
setShowSideDrawer(state, val) {
|
||||
state.showSideDrawer = val
|
||||
},
|
||||
setBookshelfView(state, val) {
|
||||
state.bookshelfView = val
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue