Add:Collapse series and collapse sub-series settings #99

This commit is contained in:
advplyr 2023-03-03 17:05:23 -06:00
parent a81f50878e
commit 33bdee66a3
4 changed files with 76 additions and 10 deletions

View file

@ -2,11 +2,8 @@
<div class="w-full h-9 bg-bg relative z-20">
<div id="bookshelf-toolbar" class="absolute top-0 left-0 w-full h-full z-20 flex items-center px-2">
<div class="flex items-center w-full text-sm">
<nuxt-link to="/bookshelf/series" v-if="selectedSeriesName" class="pt-1">
<span class="material-icons">arrow_back</span>
</nuxt-link>
<p v-show="!selectedSeriesName" class="pt-1">{{ totalEntities }} {{ entityTitle }}</p>
<p v-show="selectedSeriesName" class="ml-2pt-1">{{ selectedSeriesName }} ({{ totalEntities }})</p>
<p v-show="selectedSeriesName" class="ml-2 pt-1">{{ selectedSeriesName }} ({{ totalEntities }})</p>
<div class="flex-grow" />
<span v-if="page == 'library' || seriesBookPage" class="material-icons px-2" @click="changeView">{{ !bookshelfListView ? 'view_list' : 'grid_view' }}</span>
<template v-if="page === 'library'">
@ -16,11 +13,13 @@
</div>
<span class="material-icons px-2" @click="showSortModal = true">sort</span>
</template>
<span v-if="(page == 'library' && isBookLibrary) || seriesBookPage" class="material-icons px-2" @click="showMoreMenuDialog = true">more_vert</span>
</div>
</div>
<modals-order-modal v-model="showSortModal" :order-by.sync="settings.mobileOrderBy" :descending.sync="settings.mobileOrderDesc" @change="updateOrder" />
<modals-filter-modal v-model="showFilterModal" :filter-by.sync="settings.mobileFilterBy" @change="updateFilter" />
<modals-dialog v-model="showMoreMenuDialog" :items="menuItems" @action="clickMenuAction" />
</div>
</template>
@ -31,7 +30,8 @@ export default {
showSortModal: false,
showFilterModal: false,
settings: {},
totalEntities: 0
totalEntities: 0,
showMoreMenuDialog: false
}
},
computed: {
@ -44,6 +44,12 @@ export default {
this.$store.commit('globals/setBookshelfListView', val)
}
},
currentLibraryMediaType() {
return this.$store.getters['libraries/getCurrentLibraryMediaType']
},
isBookLibrary() {
return this.currentLibraryMediaType === 'book'
},
hasFilters() {
return this.$store.getters['user/getUserSetting']('mobileFilterBy') !== 'all'
},
@ -79,9 +85,40 @@ export default {
},
isPodcast() {
return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast'
},
menuItems() {
if (!this.isBookLibrary) return []
if (this.seriesBookPage) {
return [
{
text: 'Collapse Sub-Series',
value: 'collapse_subseries',
icon: this.settings.collapseBookSeries ? 'check_box' : 'check_box_outline_blank'
}
]
} else {
return [
{
text: 'Collapse Series',
value: 'collapse_series',
icon: this.settings.collapseSeries ? 'check_box' : 'check_box_outline_blank'
}
]
}
}
},
methods: {
clickMenuAction(action) {
this.showMoreMenuDialog = false
if (action === 'collapse_series') {
this.settings.collapseSeries = !this.settings.collapseSeries
this.saveSettings()
} else if (action === 'collapse_subseries') {
this.settings.collapseBookSeries = !this.settings.collapseBookSeries
this.saveSettings()
}
},
updateOrder() {
this.saveSettings()
},