2021-10-23 03:08:02 +02:00
|
|
|
<template>
|
2021-11-07 20:02:56 +01:00
|
|
|
<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">
|
2021-11-04 23:35:59 +01:00
|
|
|
<span class="material-icons text-2xl">arrow_back</span>
|
|
|
|
</div>
|
2021-12-29 22:53:19 +01:00
|
|
|
|
|
|
|
<nuxt-link v-for="route in configRoutes" :key="route.id" :to="route.path" class="w-full px-4 h-12 border-b border-opacity-0 flex items-center cursor-pointer relative" :class="routeName === route.id ? 'bg-primary bg-opacity-70' : 'hover:bg-primary hover:bg-opacity-30'">
|
|
|
|
<p>{{ route.title }}</p>
|
|
|
|
<div v-show="routeName === route.iod" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
|
2021-11-08 02:52:13 +01:00
|
|
|
</nuxt-link>
|
2021-10-23 03:08:02 +02:00
|
|
|
|
2022-05-21 18:21:03 +02:00
|
|
|
<div class="w-full h-12 px-4 border-t border-black border-opacity-20 absolute left-0 flex flex-col justify-center" :style="{ bottom: streamLibraryItem && isMobileLandscape ? '300px' : '65px' }">
|
|
|
|
<div class="flex justify-between">
|
|
|
|
<p class="font-mono text-sm">v{{ $config.version }}</p>
|
|
|
|
|
|
|
|
<p class="font-mono text-xs text-gray-300 italic">{{ Source }}</p>
|
|
|
|
</div>
|
|
|
|
<a v-if="hasUpdate" :href="githubTagUrl" target="_blank" class="text-warning text-xs">Latest: {{ latestVersion }}</a>
|
2021-10-23 03:08:02 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2021-11-04 23:35:59 +01:00
|
|
|
props: {
|
|
|
|
isOpen: Boolean
|
|
|
|
},
|
2021-10-23 03:08:02 +02:00
|
|
|
data() {
|
2022-02-09 18:19:02 +01:00
|
|
|
return {}
|
2021-10-23 03:08:02 +02:00
|
|
|
},
|
|
|
|
computed: {
|
2022-05-21 18:21:03 +02:00
|
|
|
Source() {
|
|
|
|
return this.$store.state.Source
|
|
|
|
},
|
2022-05-15 00:23:22 +02:00
|
|
|
currentLibraryId() {
|
|
|
|
return this.$store.state.libraries.currentLibraryId
|
|
|
|
},
|
2022-05-04 02:16:16 +02:00
|
|
|
userIsAdminOrUp() {
|
|
|
|
return this.$store.getters['user/getIsAdminOrUp']
|
2021-12-29 22:53:19 +01:00
|
|
|
},
|
2022-06-04 19:07:38 +02:00
|
|
|
user() {
|
|
|
|
return this.$store.state.user.user || {}
|
|
|
|
},
|
|
|
|
userId() {
|
|
|
|
return this.user.id
|
|
|
|
},
|
2021-12-29 22:53:19 +01:00
|
|
|
configRoutes() {
|
2022-05-04 02:16:16 +02:00
|
|
|
if (!this.userIsAdminOrUp) {
|
2021-12-29 22:53:19 +01:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
id: 'config-stats',
|
|
|
|
title: 'Your Stats',
|
|
|
|
path: '/config/stats'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2022-05-15 00:23:22 +02:00
|
|
|
const configRoutes = [
|
2021-12-29 22:53:19 +01:00
|
|
|
{
|
|
|
|
id: 'config',
|
|
|
|
title: 'Settings',
|
|
|
|
path: '/config'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config-libraries',
|
|
|
|
title: 'Libraries',
|
|
|
|
path: '/config/libraries'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config-users',
|
|
|
|
title: 'Users',
|
|
|
|
path: '/config/users'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config-backups',
|
|
|
|
title: 'Backups',
|
|
|
|
path: '/config/backups'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config-log',
|
|
|
|
title: 'Log',
|
|
|
|
path: '/config/log'
|
2022-05-15 00:23:22 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
if (this.currentLibraryId) {
|
|
|
|
configRoutes.push({
|
2021-12-29 22:53:19 +01:00
|
|
|
id: 'config-library-stats',
|
|
|
|
title: 'Library Stats',
|
|
|
|
path: '/config/library-stats'
|
2022-05-15 00:23:22 +02:00
|
|
|
})
|
|
|
|
configRoutes.push({
|
2021-12-29 22:53:19 +01:00
|
|
|
id: 'config-stats',
|
|
|
|
title: 'Your Stats',
|
|
|
|
path: '/config/stats'
|
2022-05-15 00:23:22 +02:00
|
|
|
})
|
2022-06-04 19:07:38 +02:00
|
|
|
configRoutes.push({
|
|
|
|
id: 'config-users-id-sessions',
|
|
|
|
title: 'Your Sessions',
|
|
|
|
path: `/config/users/${this.userId}/sessions`
|
|
|
|
})
|
2022-05-15 00:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return configRoutes
|
2021-12-29 22:53:19 +01:00
|
|
|
},
|
2021-11-07 20:02:56 +01:00
|
|
|
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() {
|
2022-02-09 18:19:02 +01:00
|
|
|
return this.$store.state.globals.isMobile
|
|
|
|
},
|
|
|
|
isMobileLandscape() {
|
|
|
|
return this.$store.state.globals.isMobileLandscape
|
2021-11-07 20:02:56 +01:00
|
|
|
},
|
2021-11-04 23:35:59 +01:00
|
|
|
drawerOpen() {
|
2021-11-07 20:02:56 +01:00
|
|
|
if (this.isMobile) return this.isOpen
|
2021-11-04 23:35:59 +01:00
|
|
|
return true
|
|
|
|
},
|
2021-10-23 03:08:02 +02:00
|
|
|
routeName() {
|
|
|
|
return this.$route.name
|
|
|
|
},
|
|
|
|
versionData() {
|
|
|
|
return this.$store.state.versionData || {}
|
|
|
|
},
|
|
|
|
hasUpdate() {
|
|
|
|
return !!this.versionData.hasUpdate
|
|
|
|
},
|
|
|
|
latestVersion() {
|
|
|
|
return this.versionData.latestVersion
|
|
|
|
},
|
|
|
|
githubTagUrl() {
|
|
|
|
return this.versionData.githubTagUrl
|
2021-11-07 20:02:56 +01:00
|
|
|
},
|
2022-03-14 01:34:31 +01:00
|
|
|
streamLibraryItem() {
|
|
|
|
return this.$store.state.streamLibraryItem
|
2021-10-23 03:08:02 +02:00
|
|
|
}
|
|
|
|
},
|
2021-11-04 23:35:59 +01:00
|
|
|
methods: {
|
|
|
|
clickOutside() {
|
|
|
|
if (!this.isOpen) return
|
|
|
|
this.closeDrawer()
|
|
|
|
},
|
|
|
|
closeDrawer() {
|
|
|
|
this.$emit('update:isOpen', false)
|
|
|
|
}
|
|
|
|
}
|
2021-10-23 03:08:02 +02:00
|
|
|
}
|
|
|
|
</script>
|