Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

fix: navbar navigation buttons when tabs feature is enabled & tabs duplication during navigation (#686)

Smauga51b35d847dd
diff --git a/frontend/app/components/Navbar.vue b/frontend/app/components/Navbar.vue
index 90e77b56..26fd94f1 100644
--- a/frontend/app/components/Navbar.vue
+++ b/frontend/app/components/Navbar.vue
@@ -6,11 +6,11 @@
</div>
<div class="navbar-center">
+ <NavbarRouter />
<div v-if="tabEnabled" class="navbar-tabs-wrapper">
<AppBtnIcon v-if="!isOpened && !isMobile" icon="burger" class="open-sidebar inline-burger" @click="toggleSidebar" />
<Tab class="navbar-tabs" />
</div>
- <NavbarRouter />
<div id="navbar-title" class="navbar-title" />
</div>
diff --git a/frontend/app/components/NavbarRouter.vue b/frontend/app/components/NavbarRouter.vue
index f0dba631..bcf24601 100644
--- a/frontend/app/components/NavbarRouter.vue
+++ b/frontend/app/components/NavbarRouter.vue
@@ -1,12 +1,12 @@
<template>
- <template v-if="hasNavigation.navigation">
+ <div v-if="hasNavigation.navigation">
<button :disabled="!canGoBack" class="nav no-tablet" aria-label="Go back" type="button" @click="goBack">
<Icon name="left_arrow" display="lg" />
</button>
<button :disabled="!canGoForward" class="nav no-tablet" aria-label="Go forward" type="button" @click="goForward">
<Icon name="right_arrow" display="lg" />
</button>
- </template>
+ </div>
</template>
<script lang="ts" setup>
@@ -33,6 +33,13 @@ router.afterEach(() => handleState(window.history.state));
</script>
<style lang="scss" scoped>
+div {
+ display: inline-flex;
+ justify-content: center;
+ align-items: center;
+ gap: 0.5rem;
+}
+
.nav {
display: inline-flex;
justify-content: center;
diff --git a/frontend/app/composables/useTabsSync.ts b/frontend/app/composables/useTabsSync.ts
index e493e09a..49e739aa 100644
--- a/frontend/app/composables/useTabsSync.ts
+++ b/frontend/app/composables/useTabsSync.ts
@@ -5,13 +5,11 @@ export function useTabsSync() {
const { t } = useI18nT();
function resolveTabTitle(): string {
- // 1. Tenter de récupérer le nom via l'ID du Node dans l'URL
if (route.params.id) {
const node = nodesStore.getById(route.params.id as string);
if (node?.name) return node.name;
}
- // 2. Tenter de récupérer le titre via les métadonnées/breadcrumbs de la route
let i = route.matched.length - 1;
let page = route.matched[i];
while (page && !page.meta?.breadcrumb && i > 0) {
@@ -37,11 +35,9 @@ export function useTabsSync() {
return 'Page';
}
- // Watcher unique pour synchroniser le store avec l'URL active
watch(
- () => route.fullPath, // Utilise fullPath au cas où les query params comptent pour tes onglets
+ () => route.path,
path => {
- // Évite d'ajouter des pages hors dashboard (ex: login) si nécessaire
if (!path.startsWith('/dashboard')) return;
tabsStore.syncTab({