Skip to content

Commit

Permalink
only render info meno on the side for about and helpMenu.path
Browse files Browse the repository at this point in the history
  • Loading branch information
martinapippi committed Apr 4, 2024
1 parent 00498fe commit 09cefd9
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/layouts/DefaultLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
<v-list density="compact">
<v-list-subheader>Switch to</v-list-subheader>
<v-list-item
aria-label="Menu button"
class="ma-1"
rounded
variant="tonal"
v-for="(item, i) in navigationMenuComponents"
:key="i"
:value="item"
Expand All @@ -54,18 +50,21 @@
</v-list-item>
</v-list>
</v-menu>
<v-list density="compact" v-if="navigationMenuComponents.length === 1">
<v-list density="compact" v-if="shouldRenderInfoMenu">
<v-list-item
v-if="$router.hasRoute(navigationMenuComponents[0].to.name)"
:value="navigationMenuComponents[0]"
:to="navigationMenuComponents[0].to"
aria-label="Menu button"
class="ma-1"
rounded
variant="tonal"
v-for="(item, i) in navigationMenuComponents"
:key="i"
:value="item"
:to="item.to"
>
<template v-slot:prepend>
<v-icon :icon="navigationMenuComponents[0].icon"></v-icon>
<v-icon :icon="item.icon"></v-icon>
</template>
<v-list-item-title
v-text="navigationMenuComponents[0].title"
></v-list-item-title>
<v-list-item-title v-text="item.title"></v-list-item-title>
</v-list-item>
</v-list>
</template>
Expand Down Expand Up @@ -268,6 +267,14 @@ const navigationMenuComponents = computed(() => {
return components
})
const shouldRenderInfoMenu = computed(() => {
if (helpMenu.value === undefined) return false
const paths = helpMenu.value.path.map((item: any) => item.path)
paths.push('about')
const path = route.path.substring(route.path.lastIndexOf('/') + 1)
return paths.includes(path)
})
async function getLocalOrRemoteFile(localBase: string, relativePath?: string) {
if (!relativePath) return
const remoteUrl = getResourcesStaticUrl(relativePath)
Expand Down

0 comments on commit 09cefd9

Please sign in to comment.