π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
New settings as a modal
Smaug6739ed92681f68c1
diff --git a/frontend/app/components/Sidebar/Dock.vue b/frontend/app/components/Sidebar/Dock.vueindex 299a31e0..03a59e70 100644--- a/frontend/app/components/Sidebar/Dock.vue+++ b/frontend/app/components/Sidebar/Dock.vue@@ -20,7 +20,7 @@<Icon name="users" fill="var(--font-color)" :big="true" /></NuxtLink><div style="margin-top: auto">- <NuxtLink to="/dashboard/settings">+ <NuxtLink @click="openSettings"><Icon name="settings" fill="var(--font-color)" :big="true" /></NuxtLink><NuxtLink @click="closeDock">@@ -31,6 +31,10 @@</template><script setup lang="ts">+import SettingsModal from '@/pages/dashboard/settings/modal.vue';+const openSettings = () => {+ useModal().add(new Modal(shallowRef(SettingsModal), { props: {}, size: 'large', noPadding: true }));+};function closeDock() {usePreferences().set('view_dock', false);}diff --git a/frontend/app/pages/dashboard/settings/_views/advanced.vue b/frontend/app/pages/dashboard/settings/_views/advanced.vuenew file mode 100644index 00000000..6528f8d2--- /dev/null+++ b/frontend/app/pages/dashboard/settings/_views/advanced.vue@@ -0,0 +1,27 @@+<template>+ <div>+ <h2 class="ctitle">Advanced</h2>+ <p class="csubtitle">Manage advanced settings for the application.</p>+ <p>Be careful with these settings, they can seriously affect the application.</p>++ <div class="settings-section">+ <div class="setting">+ <h4>Reset all preferences</h4>+ <p>This will reset all your preferences to their default values. This action cannot be undone.</p>+ <AppButton type="danger" @click="usePreferences().reset">Reset preferences</AppButton>+ </div>+ <div class="setting">+ <h4>Reset local storage</h4>+ <p>This will reset all your local storage data. This action cannot be undone. This action will also reset preferences.</p>+ <AppButton type="danger" @click="deleteLocalStorage">Delete local storage</AppButton>+ </div>+ </div>+ </div>+</template>++<script setup lang="ts">+const deleteLocalStorage = () => {+ localStorage.clear();+ location.reload();+};+</script>diff --git a/frontend/app/pages/dashboard/settings/index.vue b/frontend/app/pages/dashboard/settings/index.vueindex a1ddb06d..fefc7d91 100644--- a/frontend/app/pages/dashboard/settings/index.vue+++ b/frontend/app/pages/dashboard/settings/index.vue@@ -1,46 +1,45 @@<template>- <div :class="{ 'modal-mask': !isMobile() }" style="z-index: 100">- <div class="component">- <nav>- <span>Account settings</span>- <div v-if="store.user" class="user">- <img :src="useAvatar(store.user)" alt="Avatar" style="width: 25px; height: 25px; border-radius: 50%" />- <div>- <div class="username">{{ store.user.username }}</div>- <div class="email">{{ store.user.email }}</div>- </div>+ <div :class="['component', isModal ? 'modal' : '']">+ <nav>+ <span v-if="isModal">Account settings</span>+ <div v-if="isModal && store.user" class="user">+ <img :src="useAvatar(store.user)" alt="Avatar" style="width: 25px; height: 25px; border-radius: 50%" />+ <div>+ <div class="username">{{ store.user.username }}</div>+ <div class="email">{{ store.user.email }}</div></div>- <span>General</span>- <NuxtLink to="?p=profile"><Icon fill="var(--font-color)" name="profil" />My profile</NuxtLink>- <NuxtLink to="?p=preferences"><Icon fill="var(--font-color)" name="settings" />Preferences</NuxtLink>- <NuxtLink to="?p=security"><Icon fill="var(--font-color)" name="security" />Security</NuxtLink>- <NuxtLink to="?p=backup"><Icon fill="var(--font-color)" name="backup" />Backup</NuxtLink>- <span>Workspaces</span>- <NuxtLink to="/dashboard/categories"><Icon fill="var(--font-color)" name="categories" />Manage categories</NuxtLink>- <NuxtLink to="/dashboard/docs"><Icon fill="var(--font-color)" name="draft" />Manage documents</NuxtLink>- <NuxtLink to="/dashboard/import" style="display: flex; align-items: center"- ><Icon fill="var(--font-color)" name="import" />Manage importations <tag yellow>Beta</tag></NuxtLink- >- <span>Utils <tag blue>New</tag></span>- <NuxtLink to="?p=shortcuts"><Icon fill="var(--font-color)" name="shortcuts" />Shortcuts</NuxtLink>- <NuxtLink to="?p=snippets"><Icon fill="var(--font-color)" name="snippets" />Snippets</NuxtLink>- <NuxtLink to="?p=markdown"><Icon fill="var(--font-color)" name="markdown" />Markdown</NuxtLink>-- <span>Other</span>- <NuxtLink to="?p=about"><Icon fill="var(--font-color)" name="view" />About</NuxtLink>- <NuxtLink @click="logoutUser"><Icon fill="var(--font-color)" name="logout" />Logout</NuxtLink>- </nav>- <div class="content">- <button class="close-btn" @click="close"><Icon name="close" :big="true" /></button>- <ProfileView v-if="currentPage === 'profile'" />- <PreferencesView v-else-if="currentPage === 'preferences'" />- <SecurityView v-else-if="currentPage === 'security'" />- <BackupView v-else-if="currentPage == 'backup'" />- <ShortcutsView v-else-if="currentPage == 'shortcuts'" />- <SnippetsView v-else-if="currentPage == 'snippets'" />- <MarkdownView v-else-if="currentPage == 'markdown'" />- <AboutView v-else-if="currentPage == 'about'" /></div>+ <span>General</span>+ <NuxtLink @click="setPage('profile')"><Icon fill="var(--font-color)" name="profil" />My profile</NuxtLink>+ <NuxtLink @click="setPage('preferences')"><Icon fill="var(--font-color)" name="settings" />Preferences</NuxtLink>+ <NuxtLink @click="setPage('security')"><Icon fill="var(--font-color)" name="security" />Security</NuxtLink>+ <NuxtLink @click="setPage('backup')"><Icon fill="var(--font-color)" name="backup" />Backup</NuxtLink>+ <span>Workspaces</span>+ <NuxtLink to="/dashboard/categories"><Icon fill="var(--font-color)" name="categories" />Manage categories</NuxtLink>+ <NuxtLink to="/dashboard/docs"><Icon fill="var(--font-color)" name="draft" />Manage documents</NuxtLink>+ <NuxtLink to="/dashboard/import" style="display: flex; align-items: center"+ ><Icon fill="var(--font-color)" name="import" />Manage importations <tag yellow>Beta</tag></NuxtLink+ >+ <span>Utils <tag blue>New</tag></span>+ <NuxtLink @click="setPage('shortcuts')"><Icon fill="var(--font-color)" name="shortcuts" />Shortcuts</NuxtLink>+ <NuxtLink @click="setPage('snippets')"><Icon fill="var(--font-color)" name="snippets" />Snippets</NuxtLink>+ <NuxtLink @click="setPage('markdown')"><Icon fill="var(--font-color)" name="markdown" />Markdown</NuxtLink>+ <NuxtLink @click="setPage('advanced')"><Icon fill="var(--font-color)" name="advanced" />Advanced</NuxtLink>++ <span>Other</span>+ <NuxtLink @click="setPage('about')"><Icon fill="var(--font-color)" name="view" />About</NuxtLink>+ <NuxtLink @click="logoutUser"><Icon fill="var(--font-color)" name="logout" />Logout</NuxtLink>+ </nav>+ <div class="content">+ <ProfileView v-if="currentPage === 'profile'" />+ <PreferencesView v-else-if="currentPage === 'preferences'" />+ <SecurityView v-else-if="currentPage === 'security'" />+ <BackupView v-else-if="currentPage == 'backup'" />+ <ShortcutsView v-else-if="currentPage == 'shortcuts'" />+ <SnippetsView v-else-if="currentPage == 'snippets'" />+ <MarkdownView v-else-if="currentPage == 'markdown'" />+ <AboutView v-else-if="currentPage == 'about'" />+ <AdvancedView v-else-if="currentPage == 'advanced'" /></div></div></template>@@ -54,36 +53,31 @@ import ShortcutsView from './_views/shortcuts.vue';import SnippetsView from './_views/snippets.vue';import MarkdownView from './_views/markdown.vue';import AboutView from './_views/about.vue';+import AdvancedView from './_views/advanced.vue';+const route = useRoute();-const currentPage = ref(route.query.p || 'profile');const store = useUserStore();-const router = useRouter();+defineProps<{ isModal?: boolean }>();+const currentPage = ref(route.query.p || 'profile');-const routeBeforeEnter = ref();-onBeforeMount(() => (routeBeforeEnter.value = useRouter().options.history.state.back));-watchEffect(() => (currentPage.value = route.query.p || 'profile'));-const close = () => router.push(!routeBeforeEnter.value?.startsWith('/dashboard/settings') ? routeBeforeEnter.value : '/dashboard');+const setPage = (p: string) => (currentPage.value = p);+watchEffect(() => {+ if (route.query.p && typeof route.query.p === 'string') currentPage.value = route.query.p;+});</script><style scoped lang="scss">.component {display: flex;- width: 1150px;- max-width: calc(-100px + 100vw);- height: calc(-100px + 100vh);- max-height: 715px;- margin: auto;- border-radius: 8px;+ width: 100%;+ height: 100%;background-color: var(--bg-color);- box-shadow: 0 2px 10px var(--shadow);nav {padding: 1rem;- background-color: var(--bg-contrast);- border-bottom-left-radius: 8px;- border-top-left-radius: 8px;gap: 1rem;overflow-y: auto;+ border-right: 1px solid var(--border-color);span {font-size: 0.9rem;font-weight: 500;@@ -92,8 +86,8 @@ const close = () => router.push(!routeBeforeEnter.value?.startsWith('/dashboard/a {display: flex;- margin: 0.2rem;- padding: 0.2rem 0.4rem;+ margin: 0.4rem 0.2rem;+ padding: 0.05rem 0.4rem;border-radius: 6px;color: inherit;align-items: center;@@ -124,17 +118,21 @@ const close = () => router.push(!routeBeforeEnter.value?.startsWith('/dashboard/.content {position: relative;- margin: 0.5rem;- padding: 1rem 2rem;+ margin: 0 0.5rem;+ padding: 0 2rem;flex: 1;overflow-y: auto;}-.close-btn {- position: absolute;- top: 1rem;- right: 0;- background: none;+.modal {+ nav {+ border: none;+ background-color: var(--bg-contrast);+ }+ .content {+ margin: 0.5rem;+ padding: 1rem 2rem;+ }}@media screen and (width <= 920px) {@@ -145,9 +143,5 @@ const close = () => router.push(!routeBeforeEnter.value?.startsWith('/dashboard/height: 100%;box-shadow: none;}-- .close-btn {- display: none;- }}</style>diff --git a/frontend/app/pages/dashboard/settings/modal.vue b/frontend/app/pages/dashboard/settings/modal.vuenew file mode 100644index 00000000..54eb1d0e--- /dev/null+++ b/frontend/app/pages/dashboard/settings/modal.vue@@ -0,0 +1,68 @@+<template>+ <IndexSettings class="component" :is-modal="true" />+</template>++<script setup lang="ts">+import IndexSettings from './index.vue';+</script>++<style scoped lang="scss">+.component {+ display: flex;+ max-width: 1150px;+ width: 100%;+ height: 715px;+ max-height: 90vh;+ border-radius: 8px;++ nav {+ padding: 1rem;+ background-color: var(--bg-contrast) !important;+ border-bottom-left-radius: 8px;+ border-top-left-radius: 8px;+ gap: 1rem;+ overflow-y: auto;+ span {+ font-size: 0.9rem;+ font-weight: 500;+ color: var(--font-color-light);+ }++ a {+ display: flex;+ margin: 0.2rem;+ padding: 0.2rem 0.4rem;+ border-radius: 6px;+ color: inherit;+ align-items: center;+ gap: 0.5rem;+ text-decoration: none;++ &:hover {+ background-color: var(--bg-contrast-2);+ }+ }+ .title {+ display: block !important;+ }+ .user {+ display: flex !important;+ align-items: center;++ div {+ font-size: 0.8rem;+ margin-left: 5px;++ .email {+ font-size: 0.7rem;+ color: var(--font-color-light);+ }+ }+ }+ }+ .content {+ margin: 0.5rem;+ padding: 1rem 2rem;+ }+}+</style>