Fix:Hide library list button from app bar when no network connection

This commit is contained in:
advplyr 2024-02-04 15:53:05 -06:00
parent d5411703ca
commit fcd6270f2d

View file

@ -7,7 +7,7 @@
<a v-if="showBack" @click="back" class="rounded-full h-10 w-10 flex items-center justify-center mr-2 cursor-pointer"> <a v-if="showBack" @click="back" class="rounded-full h-10 w-10 flex items-center justify-center mr-2 cursor-pointer">
<span class="material-icons text-3xl text-fg">arrow_back</span> <span class="material-icons text-3xl text-fg">arrow_back</span>
</a> </a>
<div v-if="user && currentLibrary"> <div v-if="user && currentLibrary && networkConnected">
<div class="pl-1.5 pr-2.5 py-2 bg-bg bg-opacity-30 rounded-md flex items-center" @click="clickShowLibraryModal"> <div class="pl-1.5 pr-2.5 py-2 bg-bg bg-opacity-30 rounded-md flex items-center" @click="clickShowLibraryModal">
<ui-library-icon :icon="currentLibraryIcon" :size="4" font-size="base" /> <ui-library-icon :icon="currentLibraryIcon" :size="4" font-size="base" />
<p class="text-sm leading-4 ml-2 mt-0.5 max-w-24 truncate">{{ currentLibraryName }}</p> <p class="text-sm leading-4 ml-2 mt-0.5 max-w-24 truncate">{{ currentLibraryName }}</p>
@ -54,14 +54,17 @@ export default {
this.$store.commit('setCastAvailable', val) this.$store.commit('setCastAvailable', val)
} }
}, },
networkConnected() {
return this.$store.state.networkConnected
},
currentLibrary() { currentLibrary() {
return this.$store.getters['libraries/getCurrentLibrary'] return this.$store.getters['libraries/getCurrentLibrary']
}, },
currentLibraryName() { currentLibraryName() {
return this.currentLibrary ? this.currentLibrary.name : '' return this.currentLibrary?.name || ''
}, },
currentLibraryIcon() { currentLibraryIcon() {
return this.currentLibrary ? this.currentLibrary.icon : 'database' return this.currentLibrary?.icon || 'database'
}, },
showBack() { showBack() {
if (!this.$route.name) return true if (!this.$route.name) return true
@ -71,7 +74,7 @@ export default {
return this.$store.state.user.user return this.$store.state.user.user
}, },
username() { username() {
return this.user ? this.user.username : 'err' return this.user?.username || 'err'
}, },
isCasting() { isCasting() {
return this.$store.state.isCasting return this.$store.state.isCasting