📚 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
Fixes & optimizations
Smaug673925636581cf56
diff --git a/frontend/components/AppToggle.vue b/frontend/components/AppToggle.vuenew file mode 100644index 00000000..3d242234--- /dev/null+++ b/frontend/components/AppToggle.vue@@ -0,0 +1,55 @@+<template>+ <button class="toggle" :class="{ active }" @click="toggle" :aria-pressed="active" role="switch">+ <span class="circle"></span>+ </button>+</template>++<script setup lang="ts">+defineProps<{+ active: boolean;+}>();++const emit = defineEmits<{+ (e: 'toggle'): void;+}>();++const toggle = () => {+ emit('toggle');+};+</script>++<style scoped lang="scss">+.toggle {+ width: 44px;+ height: 24px;+ background: var(--bg-contrast-2);+ border-radius: 15px;+ border: 1px solid var(--border-color, #ccc);+ display: flex;+ align-items: center;+ padding: 2px;+ cursor: pointer;+ transition: background-color 0.3s ease, border-color 0.3s ease;++ .circle {+ width: 20px;+ height: 20px;+ background: var(--bg-color);+ border-radius: 50%;+ transition: transform 0.25s ease, background-color 0.25s, border-color 0.25s;+ transform: translateX(0);+ border: 1px solid transparent;+ }++ &.active {+ background: rgba($primary-color, 0.9); // léger fond coloré+ border-color: $primary-color;++ .circle {+ transform: translateX(20px);+ background: #fff; // cercle toujours blanc+ border-color: $primary-color;+ }+ }+}+</style>diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.tsindex 8bcc067f..93b28403 100644--- a/frontend/nuxt.config.ts+++ b/frontend/nuxt.config.ts@@ -1,6 +1,5 @@export default defineNuxtConfig({- devtools: { enabled: true },-+ devtools: { enabled: process.env.NODE_ENV !== 'production' },future: {compatibilityVersion: 4,},@@ -24,6 +23,10 @@ export default defineNuxtConfig({},},},+ nitro: {+ compressPublicAssets: true,+ minify: true,+ },$production: {ignore: ['**/*.stories.{js,cts,mts,ts,jsx,tsx}',@@ -47,6 +50,7 @@ export default defineNuxtConfig({experimental: {viewTransition: true,+ payloadExtraction: true,},app: {@@ -92,6 +96,14 @@ export default defineNuxtConfig({rel: 'preconnect',href: 'https://fonts.gstatic.com',},+ {+ rel: 'preconnect',+ href: 'https://api.alexandrie-hub.fr',+ },+ {+ rel: 'preconnect',+ href: 'https://cdn.alexandrie-hub.fr',+ },],},},diff --git a/frontend/pages/dashboard/cdn/[id].vue b/frontend/pages/dashboard/cdn/[id].vueindex 04ac712c..87503300 100644--- a/frontend/pages/dashboard/cdn/[id].vue+++ b/frontend/pages/dashboard/cdn/[id].vue@@ -1,7 +1,7 @@<template><div style="padding: 24px; gap: 16px" class="card-component"><header>- <h2>Update ressource <tag blue>New</tag></h2>+ <h3>Update ressource <tag blue>New</tag></h3>Manage ressources and files on the server. You can edit metadata and delete file from the server.</header><form @submit.prevent v-if="ressource">@@ -55,7 +55,7 @@ const updateCategory = async () => {.update(ressource.value).then(() => {useNotifications().add({ type: 'success', title: 'Ressource updated' });- useRouter().push('/dashboard');+ useRouter().push('/dashboard/cdn');}).catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e }));};diff --git a/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue b/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vuenew file mode 100644index 00000000..7128b0ef--- /dev/null+++ b/frontend/pages/dashboard/cdn/_modals/DeleteRessourceModal.vue@@ -0,0 +1,31 @@+<template>+ <div class="modal">+ <h3>Delete ressource</h3>+ <p>Are you sure you want to delete this ressource ?</p>+ <p style="opacity: 0.7">This action is irreversible</p>+ <div class="footer">+ <AppButton @click="emit('close')" type="secondary">Cancel</AppButton>+ <AppButton @click="deleteRessource" type="danger">Confirm</AppButton>+ </div>+ </div>+</template>++<script setup lang="ts">+const props = defineProps<{ ressourceId: string }>();+const emit = defineEmits(['close']);+const deleteRessource = async () => {+ await useRessourcesStore()+ .delete(props.ressourceId)+ .then(() => {+ useNotifications().add({ type: 'success', title: 'Ressource deleted successfully' });+ emit('close');+ })+ .catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e }));+};+</script>++<style scoped lang="scss">+.modal {+ min-width: 500px;+}+</style>diff --git a/frontend/pages/dashboard/cdn/index.vue b/frontend/pages/dashboard/cdn/index.vueindex 23147305..ed46f5b9 100644--- a/frontend/pages/dashboard/cdn/index.vue+++ b/frontend/pages/dashboard/cdn/index.vue@@ -28,6 +28,7 @@</div></template><script setup lang="ts">+import DeleteRessourceModal from './_modals/DeleteRessourceModal.vue';import type { DB_Ressource } from '~/stores';const ressourcesStore = useRessourcesStore();@@ -88,11 +89,7 @@ const rows: any = computed(() =>);const deleteRessource = async (id: string) => {- if (!id) return;- await ressourcesStore- .delete(id)- .then(() => useNotifications().add({ type: 'success', title: 'Ressource deleted successfully' }))- .catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e }));+ useModal().add(new Modal(shallowRef(DeleteRessourceModal), { ressourceId: id }));};</script>diff --git a/frontend/pages/dashboard/settings/_views/preferences.vue b/frontend/pages/dashboard/settings/_views/preferences.vueindex dc199773..2f6f81a8 100644--- a/frontend/pages/dashboard/settings/_views/preferences.vue+++ b/frontend/pages/dashboard/settings/_views/preferences.vue@@ -1,17 +1,15 @@<template><h1>Preferences</h1>- <div v-for="(option, index) in options" :key="index" class="form-group toggle-group">+ <div v-for="(option, index) in options" :key="option.id" class="form-group"><label :for="option.id">{{ option.label }}</label>- <div :id="option.id" class="toggle-button" :class="{ active: option.value }" @click="toggleOption(index)">- <span class="toggle-slider"></span>- </div>+ <AppToggle :active="option.value" @toggle="toggleOption(index)" /></div></template><script setup lang="ts">const colorMode = useColorMode();const preferencesStore = usePreferencesStore();-// Define options dynamically+const options = ref([{id: 'print-mode-toggle',@@ -40,7 +38,6 @@ const options = ref([},]);-// Toggle function for optionsconst toggleOption = (index: number) => {const option = options.value[index];if (!option) return;@@ -54,45 +51,11 @@ const toggleOption = (index: number) => {.form-group {display: flex;align-items: center;- gap: 1rem;justify-content: space-between;- max-width: 90%;- .toggle-group {- display: flex;- align-items: center;- gap: 2rem;- }- label {- margin: 10px 0;- }-- .toggle-button {- width: 50px;- height: 25px;- background-color: var(--bg-contrast-2);- border-radius: 25px;- position: relative;- cursor: pointer;- transition: background-color 0.3s ease;-- &.active {- background-color: $primary-color;- }-- .toggle-slider {- width: 20px;- height: 20px;- background-color: var(--bg-color);- border-radius: 50%;- position: absolute;- top: 2.5px;- left: 3px;- transition: transform 0.3s ease;- }-- &.active .toggle-slider {- transform: translateX(25px);- }- }+ gap: 1rem;+ margin-bottom: 1rem;+}+label {+ font-weight: 500;}</style>