From 05d9447c3c9b39b5d7dfcfabe328e67315894f6f Mon Sep 17 00:00:00 2001 From: Alain Nussbaumer Date: Sun, 23 Feb 2025 12:41:51 +0100 Subject: [PATCH] [web] Simplify the navigation bar --- web-src/src/components/ControlLink.vue | 18 +- web-src/src/components/NavbarTop.vue | 261 +++++++++++-------------- 2 files changed, 116 insertions(+), 163 deletions(-) diff --git a/web-src/src/components/ControlLink.vue b/web-src/src/components/ControlLink.vue index 997af8c8..5304777f 100644 --- a/web-src/src/components/ControlLink.vue +++ b/web-src/src/components/ControlLink.vue @@ -1,5 +1,5 @@ @@ -12,25 +12,13 @@ export default { props: { to: { required: true, type: Object } }, - setup() { return { uiStore: useUIStore() } }, - - computed: { - href() { - return this.$router.resolve(this.to).href - } - }, - methods: { open() { - if (this.uiStore.show_burger_menu) { - this.uiStore.show_burger_menu = false - } - if (this.uiStore.show_player_menu) { - this.uiStore.show_player_menu = false - } + this.uiStore.show_burger_menu = false + this.uiStore.show_player_menu = false this.$router.push(this.to) } } diff --git a/web-src/src/components/NavbarTop.vue b/web-src/src/components/NavbarTop.vue index f2f55f44..eca5ddc9 100644 --- a/web-src/src/components/NavbarTop.vue +++ b/web-src/src/components/NavbarTop.vue @@ -1,54 +1,13 @@ - -
@@ -164,7 +69,6 @@ import { useUIStore } from '@/stores/ui' export default { name: 'NavbarTop', components: { ControlLink }, - setup() { return { searchStore: useSearchStore(), @@ -173,16 +77,88 @@ export default { uiStore: useUIStore() } }, - - data() { - return { - show_settings_menu: false - } - }, - computed: { - spotify_enabled() { - return this.servicesStore.spotify.webapi_token_valid + menus() { + return [ + { + name: 'playlists', + label: 'navigation.playlists', + icon: 'music-box-multiple', + show: this.settingsStore.show_menu_item_playlists + }, + { + name: 'music', + label: 'navigation.music', + icon: 'music', + show: this.settingsStore.show_menu_item_music + }, + { + name: 'music-artists', + label: 'navigation.artists', + show: true, + sub: true + }, + { + name: 'music-albums', + label: 'navigation.albums', + show: true, + sub: true + }, + { + name: 'music-genres', + label: 'navigation.genres', + show: true, + sub: true + }, + { + name: 'music-spotify', + label: 'navigation.spotify', + show: this.servicesStore.spotify.webapi_token_valid, + sub: true + }, + { + name: 'podcasts', + label: 'navigation.podcasts', + icon: 'microphone', + show: this.settingsStore.show_menu_item_podcasts + }, + { + name: 'audiobooks', + label: 'navigation.audiobooks', + icon: 'book-open-variant', + show: this.settingsStore.show_menu_item_audiobooks + }, + { + name: 'radio', + label: 'navigation.radio', + icon: 'radio', + show: this.settingsStore.show_menu_item_radio + }, + { + name: 'files', + label: 'navigation.files', + icon: 'folder-open', + show: this.settingsStore.show_menu_item_files + }, + { + name: this.searchStore.search_source, + label: 'navigation.search', + icon: 'magnify', + show: this.settingsStore.show_menu_item_search + }, + { separator: true, show: true }, + { + name: 'settings-webinterface', + label: 'navigation.settings', + show: true + }, + { + label: 'navigation.update-library', + action: this.open_update_dialog, + show: true + }, + { name: 'about', label: 'navigation.about', show: true } + ] }, zindex() { if (this.uiStore.show_player_menu) { @@ -191,20 +167,9 @@ export default { return '' } }, - - watch: { - $route(to, from) { - this.show_settings_menu = false - } - }, - methods: { - on_click_outside_settings() { - this.show_settings_menu = !this.show_settings_menu - }, open_update_dialog() { this.uiStore.show_update_dialog = true - this.show_settings_menu = false this.uiStore.show_burger_menu = false } }