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'
|
var bookshelfView = this.isListView ? 'list' : 'grid'
|
||||||
this.$localStore.setBookshelfView(bookshelfView)
|
this.$localStore.setBookshelfView(bookshelfView)
|
||||||
|
this.$store.commit('setBookshelfView', bookshelfView)
|
||||||
},
|
},
|
||||||
updateOrder() {
|
updateOrder() {
|
||||||
this.saveSettings()
|
this.saveSettings()
|
||||||
|
@ -113,7 +114,7 @@ export default {
|
||||||
var bookshelfView = await this.$localStore.getBookshelfView()
|
var bookshelfView = await this.$localStore.getBookshelfView()
|
||||||
this.isListView = bookshelfView === 'list'
|
this.isListView = bookshelfView === 'list'
|
||||||
this.bookshelfReady = true
|
this.bookshelfReady = true
|
||||||
console.log('Bookshelf view', bookshelfView)
|
this.$store.commit('setBookshelfView', bookshelfView)
|
||||||
},
|
},
|
||||||
settingsUpdated(settings) {
|
settingsUpdated(settings) {
|
||||||
for (const key in settings) {
|
for (const key in settings) {
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full h-full">
|
<div class="w-full h-full">
|
||||||
<template v-for="(shelf, index) in shelves">
|
<div class="w-full h-full" v-show="!isListView">
|
||||||
<bookshelf-library-shelf :key="shelf.id" :books="shelf.books" :style="{ zIndex: shelves.length - index }" />
|
<template v-for="(shelf, index) in shelves">
|
||||||
</template>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -10,10 +17,17 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
booksPerRow: 3
|
booksPerRow: 3,
|
||||||
|
pageWidth: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
bookshelfView() {
|
||||||
|
return this.$store.state.bookshelfView
|
||||||
|
},
|
||||||
|
isListView() {
|
||||||
|
return this.bookshelfView === 'list'
|
||||||
|
},
|
||||||
books() {
|
books() {
|
||||||
return this.$store.getters['audiobooks/getFilteredAndSorted']()
|
return this.$store.getters['audiobooks/getFilteredAndSorted']()
|
||||||
},
|
},
|
||||||
|
@ -37,12 +51,15 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shelf.books.length) {
|
if (shelf.books.length) {
|
||||||
|
shelf.id++
|
||||||
shelves.push(shelf)
|
shelves.push(shelf)
|
||||||
}
|
}
|
||||||
return shelves
|
return shelves
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {},
|
||||||
mounted() {}
|
mounted() {
|
||||||
|
this.pageWidth = window.innerWidth
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,7 +16,8 @@ export const state = () => ({
|
||||||
showReader: false,
|
showReader: false,
|
||||||
downloadFolder: null,
|
downloadFolder: null,
|
||||||
mediaScanResults: {},
|
mediaScanResults: {},
|
||||||
showSideDrawer: false
|
showSideDrawer: false,
|
||||||
|
bookshelfView: 'grid'
|
||||||
})
|
})
|
||||||
|
|
||||||
export const getters = {
|
export const getters = {
|
||||||
|
@ -104,5 +105,8 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
setShowSideDrawer(state, val) {
|
setShowSideDrawer(state, val) {
|
||||||
state.showSideDrawer = val
|
state.showSideDrawer = val
|
||||||
|
},
|
||||||
|
setBookshelfView(state, val) {
|
||||||
|
state.bookshelfView = val
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue