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.

Add navbar preferences, close #69

Smaug6739e4aa112a1c41
diff --git a/frontend/app/components/BreadCrumb.vue b/frontend/app/components/BreadCrumb.vue
index 679213b8..5f254650 100644
--- a/frontend/app/components/BreadCrumb.vue
+++ b/frontend/app/components/BreadCrumb.vue
@@ -1,7 +1,11 @@
<template>
<nav class="breadcrumb">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" @click="next"><path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z" /></svg>
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" @click="previous"><path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z" /></svg>
+ <svg v-if="preferences.get('navbarItems').value.navigation" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" @click="next">
+ <path d="M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z" />
+ </svg>
+ <svg v-if="preferences.get('navbarItems').value.navigation" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" @click="previous">
+ <path d="M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z" />
+ </svg>
<ol class="breadcrumb">
<li v-for="(segment, index) in breadcrumbs" :key="index" class="breadcrumb-item">
<NuxtLink :to="segment.path"> {{ segment.name }} </NuxtLink>
@@ -14,6 +18,7 @@
const route = useRoute();
const router = useRouter();
const breadcrumbs: Ref<Array<{ name: string; path: string }>> = ref([]);
+const preferences = usePreferences();
const next = () => useRouter().go(-1);
const previous = () => useRouter().go(1);
diff --git a/frontend/app/components/Navbar.vue b/frontend/app/components/Navbar.vue
index d12dd738..77272772 100644
--- a/frontend/app/components/Navbar.vue
+++ b/frontend/app/components/Navbar.vue
@@ -6,23 +6,28 @@
<path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z" />
</svg>
</button>
- <IconApp v-if="!isOpened" style="width: 40px" />
- <BreadCrumb v-if="!isMobile()" />
+ <BreadCrumb v-if="!isMobile() && preferences.get('navbarItems').value.breadcrumb" />
</div>
<div>
- <button class="search-btn" title="Command center (Ctrl+K)" aria-label="Command center" @click="openCommandCenter">
+ <button
+ v-if="preferences.get('navbarItems').value.search"
+ class="search-btn"
+ title="Command center (Ctrl+K)"
+ aria-label="Command center"
+ @click="openCommandCenter"
+ >
<Icon name="search" fill="var(--font-color)" />
<span class="search-text">Search</span>
<kbd class="shortcut">Ctrl+K</kbd>
</button>
-
- <ThemeToggle aria-label="toggle theme" />
+ <ThemeToggle v-if="preferences.get('navbarItems').value.theme" aria-label="toggle theme" />
</div>
</header>
</template>
<script lang="ts" setup>
const { toggleSidebar, isOpened } = useSidebar();
+const preferences = usePreferences();
const openCommandCenter = () => window.dispatchEvent(new CustomEvent('command-center-open'));
</script>
<style lang="scss" scoped>
diff --git a/frontend/app/composables/Preferences.ts b/frontend/app/composables/Preferences.ts
index 6343546a..74136676 100644
--- a/frontend/app/composables/Preferences.ts
+++ b/frontend/app/composables/Preferences.ts
@@ -19,6 +19,12 @@ export const DEFAULT_PREFERENCES = {
documents: false as boolean,
newPage: false as boolean,
} as Record<string, boolean>,
+ navbarItems: {
+ breadcrumb: true as boolean,
+ search: true as boolean,
+ theme: true as boolean,
+ navigation: true as boolean,
+ },
};
// Crée un type mapping automatique : chaque clé => type exact
diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vue
index c4e8ff2f..2954f52b 100644
--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue
+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue
@@ -155,7 +155,28 @@ const options = ref<{ label: string; options: Option[] }[]>([
home: 'Home',
newPage: 'New Page',
},
- onChange: val => console.log('Sidebar items changed', val),
+ },
+ ],
+ },
+ {
+ label: 'Nabvar',
+ options: [
+ {
+ label: 'Show items in navbar',
+ type: 'groupCheckbox',
+ key: 'navbarItems',
+ value: {
+ breadcrumb: true,
+ search: true,
+ theme: true,
+ navigation: true,
+ },
+ items: {
+ breadcrumb: 'Breadcrumb',
+ search: 'Search',
+ theme: 'Theme',
+ navigation: 'Navigation',
+ },
},
],
},