Change: njodb version bump, Fix: Socket reconnect & toast, Fix: Mobile config nav drawer

This commit is contained in:
advplyr
2021-11-07 13:02:56 -06:00
parent 2af017e3b1
commit d115382abe
6 changed files with 81 additions and 26 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="w-44 fixed left-0 top-16 z-40 h-full bg-bg bg-opacity-100 md:bg-opacity-70 shadow-lg border-r border-white border-opacity-5 py-4 transform transition-transform" :class="drawerOpen ? 'translate-x-0' : '-translate-x-44'" v-click-outside="clickOutside">
<div class="md:hidden flex items-center justify-end py-2 px-4 mb-1" @click="closeDrawer">
<div class="w-44 fixed left-0 top-16 h-full bg-bg bg-opacity-100 md:bg-opacity-70 shadow-lg border-r border-white border-opacity-5 py-3 transform transition-transform" :class="wrapperClass" v-click-outside="clickOutside">
<div class="md:hidden flex items-center justify-end pb-2 px-4 mb-1" @click="closeDrawer">
<span class="material-icons text-2xl">arrow_back</span>
</div>
<nuxt-link to="/config" class="w-full px-4 h-12 border-b border-opacity-0 flex items-center cursor-pointer relative" :class="routeName === 'config' ? 'bg-primary bg-opacity-70' : 'hover:bg-primary hover:bg-opacity-30'">
@ -24,7 +24,7 @@
<div v-show="routeName === 'config-log'" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
</nuxt-link>
<div class="w-full h-12 px-4 border-t border-black border-opacity-20 absolute bottom-20 left-0 flex flex-col justify-center">
<div class="w-full h-10 px-4 border-t border-black border-opacity-20 absolute left-0 flex flex-col justify-center" :style="{ bottom: streamAudiobook && windowHeight > 700 && !isMobile ? '300px' : '65px' }">
<p class="font-mono text-sm">v{{ $config.version }}</p>
<a v-if="hasUpdate" :href="githubTagUrl" target="_blank" class="text-warning text-sm">Update available: {{ latestVersion }}</a>
</div>
@ -38,12 +38,24 @@ export default {
},
data() {
return {
windowWidth: 0
windowWidth: 0,
windowHeight: 0
}
},
computed: {
wrapperClass() {
var classes = []
if (this.drawerOpen) classes.push('translate-x-0')
else classes.push('-translate-x-44')
if (this.isMobile) classes.push('z-50')
else classes.push('z-40')
return classes.join(' ')
},
isMobile() {
return this.windowWidth < 758
},
drawerOpen() {
if (this.windowWidth < 758) return this.isOpen
if (this.isMobile) return this.isOpen
return true
},
routeName() {
@ -60,6 +72,9 @@ export default {
},
githubTagUrl() {
return this.versionData.githubTagUrl
},
streamAudiobook() {
return this.$store.state.streamAudiobook
}
},
methods: {
@ -72,11 +87,13 @@ export default {
},
resize() {
this.windowWidth = window.innerWidth
this.windowHeight = window.innerHeight
}
},
mounted() {
window.addEventListener('resize', this.resize)
this.windowWidth = this.resize
this.windowWidth = window.innerWidth
this.windowHeight = window.innerHeight
},
beforeDestroy() {
window.removeEventListener('resize', this.resize)