Add:Separate setting for alt bookshelf view on home page

This commit is contained in:
advplyr 2022-08-13 18:18:42 -05:00
parent d06c61b329
commit c5f91ec508
7 changed files with 52 additions and 15 deletions

View file

@ -70,11 +70,8 @@ export default {
libraryName() {
return this.$store.getters['libraries/getCurrentLibraryName']
},
bookshelfView() {
return this.$store.getters['getServerSetting']('bookshelfView')
},
isAlternativeBookshelfView() {
return this.bookshelfView === this.$constants.BookshelfView.TITLES
return this.$store.getters['getHomeBookshelfView'] === this.$constants.BookshelfView.TITLES
},
bookCoverWidth() {
var coverSize = this.$store.getters['user/getUserSetting']('bookshelfCoverSize')

View file

@ -112,17 +112,16 @@ export default {
coverAspectRatio() {
return this.$store.getters['libraries/getBookCoverAspectRatio']
},
bookshelfView() {
return this.$store.getters['getServerSetting']('bookshelfView')
},
sortingIgnorePrefix() {
return this.$store.getters['getServerSetting']('sortingIgnorePrefix')
},
isCoverSquareAspectRatio() {
return this.coverAspectRatio == 1
},
bookshelfView() {
return this.$store.getters['getBookshelfView']
},
isAlternativeBookshelfView() {
// if (!this.isEntityBook) return false // Only used for bookshelf showing books
return this.bookshelfView === this.$constants.BookshelfView.TITLES
},
hasFilter() {

View file

@ -61,6 +61,15 @@
</p>
</ui-tooltip>
</div> -->
<div class="flex items-center py-2">
<ui-toggle-switch v-model="homeUseAlternativeBookshelfView" :disabled="updatingServerSettings" @input="updateHomeAlternativeBookshelfView" />
<ui-tooltip :text="tooltips.bookshelfView">
<p class="pl-4">
Alternative bookshelf view for home page
<span class="material-icons icon-text text-sm">info_outlined</span>
</p>
</ui-tooltip>
</div>
<div class="flex items-center py-2">
<ui-toggle-switch v-model="useAlternativeBookshelfView" :disabled="updatingServerSettings" @input="updateAlternativeBookshelfView" />
@ -271,6 +280,7 @@ export default {
isResettingLibraryItems: false,
updatingServerSettings: false,
useSquareBookCovers: false,
homeUseAlternativeBookshelfView: false,
useAlternativeBookshelfView: false,
isPurgingCache: false,
newServerSettings: {},
@ -362,6 +372,11 @@ export default {
coverAspectRatio: val ? this.$constants.BookCoverAspectRatio.SQUARE : this.$constants.BookCoverAspectRatio.STANDARD
})
},
updateHomeAlternativeBookshelfView(val) {
this.updateServerSettings({
homeBookshelfView: val ? this.$constants.BookshelfView.TITLES : this.$constants.BookshelfView.STANDARD
})
},
updateAlternativeBookshelfView(val) {
this.updateServerSettings({
bookshelfView: val ? this.$constants.BookshelfView.TITLES : this.$constants.BookshelfView.STANDARD
@ -393,6 +408,7 @@ export default {
this.useSquareBookCovers = this.newServerSettings.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
this.homeUseAlternativeBookshelfView = this.newServerSettings.homeBookshelfView === this.$constants.BookshelfView.TITLES
this.useAlternativeBookshelfView = this.newServerSettings.bookshelfView === this.$constants.BookshelfView.TITLES
},
resetLibraryItems() {

View file

@ -75,6 +75,9 @@ const Hotkeys = {
}
}
export {
Constants
}
export default ({ app }, inject) => {
inject('constants', Constants)
inject('keynames', KeyNames)

View file

@ -1,5 +1,6 @@
import { checkForUpdate, currentVersion } from '@/plugins/version'
import Vue from 'vue'
const { Constants } = require('../plugins/constants')
export const state = () => ({
Source: null,
@ -45,6 +46,14 @@ export const getters = {
if (!state.streamLibraryItem) return null
if (!episodeId) return state.streamLibraryItem.id == libraryItemId
return state.streamLibraryItem.id == libraryItemId && state.streamEpisodeId == episodeId
},
getBookshelfView: state => {
if (!state.serverSettings || isNaN(state.serverSettings.bookshelfView)) return Constants.BookshelfView.STANDARD
return state.serverSettings.bookshelfView
},
getHomeBookshelfView: state => {
if (!state.serverSettings || isNaN(state.serverSettings.homeBookshelfView)) return Constants.BookshelfView.STANDARD
return state.serverSettings.homeBookshelfView
}
}

View file

@ -1,3 +1,5 @@
const { Constants } = require('../plugins/constants')
export const state = () => ({
libraries: [],
lastLoad: 0,
@ -49,7 +51,7 @@ export const getters = {
},
getBookCoverAspectRatio: (state, getters) => {
if (!getters.getCurrentLibrarySettings || isNaN(getters.getCurrentLibrarySettings.coverAspectRatio)) return 1
return getters.getCurrentLibrarySettings.coverAspectRatio === 0 ? 1.6 : 1
return getters.getCurrentLibrarySettings.coverAspectRatio === Constants.BookCoverAspectRatio.STANDARD ? 1.6 : 1
}
}