Skip to content

Commit

Permalink
fix: Update menu switch CSS selectors
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M. <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Nov 27, 2024
1 parent 422c733 commit ff87e41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ export default {
this.$store.commit('setActiveTableId', parseInt(currentRoute.params.tableId))
this.setPageTitle(this.$store.getters.activeTable.title)
if (!currentRoute.path.includes('/row/')) {
this.switchActiveMenuEntry(document.querySelector('header .header-left .app-menu a[title="Tables"]'))
this.switchActiveMenuEntry(document.querySelector('header .header-start .app-menu a[title="Tables"]'))
}
} else if (currentRoute.path.startsWith('/view/')) {
this.$store.commit('setActiveViewId', parseInt(currentRoute.params.viewId))
this.setPageTitle(this.$store.getters.activeView.title)
if (!currentRoute.path.includes('/row/')) {
this.switchActiveMenuEntry(document.querySelector('header .header-left .app-menu a[title="Tables"]'))
this.switchActiveMenuEntry(document.querySelector('header .header-start .app-menu a[title="Tables"]'))
}
} else if (currentRoute.path.startsWith('/application/')) {
const contextId = parseInt(currentRoute.params.contextId)
this.$store.commit('setActiveContextId', contextId)
this.setPageTitle(this.$store.getters.activeContext.name)
// This breaks if there are multiple contexts with the same name or another app has the same name. We need a better way to identify the correct element.
this.switchActiveMenuEntry(document.querySelector(`header .header-left .app-menu [title="${this.$store.getters.activeContext.name}"]`))
this.switchActiveMenuEntry(document.querySelector(`header .header-start .app-menu [title="${this.$store.getters.activeContext.name}"]`))
// move the focus away from nav bar (import for app-internal switch)
const appContent = document.getElementById('app-content-vue')
Expand All @@ -109,7 +109,7 @@ export default {
},
switchActiveMenuEntry(targetElement) {
targetElement = targetElement?.tagName?.toLowerCase() === 'a' ? targetElement.parentElement : targetElement
const currentlyActive = document.querySelector('header .header-left .app-menu li.app-menu-entry--active')
const currentlyActive = document.querySelector('header .header-start .app-menu li.app-menu-entry--active')
currentlyActive.classList.remove('app-menu-entry--active')
targetElement.classList.add('app-menu-entry--active')
},
Expand Down

0 comments on commit ff87e41

Please sign in to comment.