π 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
V5 :tada:
Veauville Raphaela155edc0b137
diff --git a/@alexandrie/styles/src/_variables.scss b/@alexandrie/styles/src/_variables.scssindex 24767534..d178b6b7 100644--- a/@alexandrie/styles/src/_variables.scss+++ b/@alexandrie/styles/src/_variables.scss@@ -31,12 +31,15 @@ $transition-duration: 0.3s;--bg-color: #FFFFFF;--bg-contrast: #F5F9FB;--bg-contrast-2: #ECF2FF;+ //--bg-color: #ECF2FF;+ // --bg-contrast: #e7ecf7;+ // --bg-contrast-2: #cdd5dd;--font-color: #333333;--border-color: rgba(0, 0, 0, 0.1);// COLORS \\--grey: #666666;--grey-bg: rgb(240, 240, 240);- --blue: #007BFF;+ --blue: #009df7;--blue-bg: #cce0ff;--blue-border: rgba(0, 123, 255, 0.3);--green: #28A745;@@ -56,8 +59,8 @@ $transition-duration: 0.3s;.dark-mode {- --bg-color: #1F1F23;- --bg-contrast: #33333A;+ --bg-color: #202025;+ --bg-contrast: #333335;--bg-contrast-2: #484852;--font-color: #DDDDDD;--border-color: rgba(255, 255, 255, 0.7);diff --git a/@alexandrie/styles/src/main.scss b/@alexandrie/styles/src/main.scssindex 5fff3656..54204fed 100644--- a/@alexandrie/styles/src/main.scss+++ b/@alexandrie/styles/src/main.scss@@ -39,11 +39,9 @@body {background: var(--bg-color);color: var(--font-color);- transition: color $transition-duration;font-family: $external-font;text-rendering: optimizeLegibility;-webkit-text-size-adjust: 100%;- transition: 0.3s;}html,diff --git a/dashboard/app.vue b/dashboard/App.vuesimilarity index 100%rename from dashboard/app.vuerename to dashboard/App.vuediff --git a/dashboard/components/MarkdownEditor/MarkdownEditor.vue b/dashboard/components/MarkdownEditor/MarkdownEditor.vueindex 2644890e..1ae177ab 100644--- a/dashboard/components/MarkdownEditor/MarkdownEditor.vue+++ b/dashboard/components/MarkdownEditor/MarkdownEditor.vue@@ -79,11 +79,6 @@ function exec(action: string) {<style scoped lang="scss">.editor-container {- font-family: $external-font;- width: 100%;- height: 100%;- border-radius: 10px;- padding: 5px;display: flex;flex-direction: column;}@@ -96,14 +91,12 @@ function exec(action: string) {.body {height: 100%;- overflow: auto;}.editor-input,.markdown-preview {padding: 8px;- max-height: 100%;- overflow: auto;+ min-height: 80vh;}.editor-input {@@ -123,9 +116,6 @@ function exec(action: string) {background-color: var(--bg-color);padding-left: 0;- &::placeholder {- color: $grey;- }&.title {font-size: 24px;diff --git a/dashboard/components/MarkdownEditor/Toolbar.vue b/dashboard/components/MarkdownEditor/Toolbar.vueindex 6e7b9ba7..53b734cf 100644--- a/dashboard/components/MarkdownEditor/Toolbar.vue+++ b/dashboard/components/MarkdownEditor/Toolbar.vue@@ -5,8 +5,8 @@@click="emitAction(item.action)"></span></div><div>- <input placeholder="#tags" class="tags input" v-model="copy.tags" />- <select v-model="copy.accessibility">+ <input placeholder="#tags" class="tags input" v-model="copy.tags" style="margin-right:5px;" />+ <select v-model="copy.accessibility" style="margin-right:5px;"><option value="1">Visible</option><option value="2">Draf</option><option value="3">Archive</option>diff --git a/dashboard/components/Navbar.vue b/dashboard/components/Navbar.vueindex 36916221..eda01984 100644--- a/dashboard/components/Navbar.vue+++ b/dashboard/components/Navbar.vue@@ -7,8 +7,10 @@</svg></span><ul>- <li>- <NuxtLink class="no-mobile" to="/">Home</NuxtLink>+ <li class="no-mobile">+ <NuxtLink to="https://alexandrie-hub.fr" target="_blank">+ View version+ </NuxtLink></li><li class="no-mobile"><NuxtLink to="https://dashboard.alexandrie-hub.fr" target="_blank">Dashboard</NuxtLink>diff --git a/dashboard/components/Preview.vue b/dashboard/components/Preview.vuedeleted file mode 100644index f19b0563..00000000--- a/dashboard/components/Preview.vue+++ /dev/null@@ -1,87 +0,0 @@-<template>- <div v-if="doc" style="position: relative;">-- <div class="header">- <NuxtLink :to="'/dashboard/edit?doc=' + doc.id">- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">- <path- d="m640-360 120-120-42-43-48 48v-125h-60v125l-48-48-42 43 120 120ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm0 0v-480 480Zm60-120h60v-180h40v120h60v-120h40v180h60v-200q0-17-11.5-28.5T440-600H260q-17 0-28.5 11.5T220-560v200Z" />- </svg>- </NuxtLink>-- <NuxtLink :to="'/dashboard/edit?doc=' + doc.id">- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">- <path- d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />- </svg>- </NuxtLink>- <NuxtLink @click="print">- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">- <path- d="M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z" />- </svg>- </NuxtLink>- <NuxtLink @click="showDeleteModal = true">-- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">- <path- d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z" />- </svg>- </NuxtLink>- <Modal :show="showDeleteModal" @close="showDeleteModal = false" @confirm="deleteDoc">- <template #header>- <h3>Delete document</h3>- </template>- <template #body>- <p>Are you sure you want to delete this document?</p>- </template>- <template #footer>- <p style="opacity: 0.7; ">This action is irreversible</p>- </template>- </Modal>- </div>- <div class="document-theme" v-html="doc.content_html"></div>- </div>-</template>-<script setup lang="ts">-import { useDocumentsStore, type Document } from '~/store';-import { useRoute } from "vue-router";-import Modal from './Modal.vue';--const route = useRoute();-const doc_id = computed(() => route.query.doc as string);-const doc = ref<Document>();-const documentsStore = useDocumentsStore();--const showDeleteModal = ref(false);--watchEffect(async () => {- const docFromStore = documentsStore.getById(doc_id.value);- if (docFromStore?.partial) {- try {- doc.value = await documentsStore.fetch({ id: doc_id.value as string });- } catch (error) {- console.error("Error fetching document:", error);- }- } else doc.value = docFromStore;-});--const print = () => window.print();-const deleteDoc = () => doc.value?.id ? documentsStore.delete(doc.value.id) : null;-</script>--<style lang="scss" scoped>-.header {- display: flex;- justify-content: flex-end;- align-items: center;- position: absolute;- top: -67px;-- svg {- cursor: pointer;- fill: $primary-400;- margin-left: 15px;- }-}-</style>\ No newline at end of filediff --git a/dashboard/components/sidebar/CollapseItem.vue b/dashboard/components/sidebar/CollapseItem.vueindex e7055c23..770f6955 100644--- a/dashboard/components/sidebar/CollapseItem.vue+++ b/dashboard/components/sidebar/CollapseItem.vue@@ -10,7 +10,7 @@<template v-for="(child, index) in item.childrens"><div style="margin-left:15px;"><CollapseItem v-if="child.childrens?.length" :item="child" :key="index" />- <NuxtLink v-else class="item children" :to="child.route">+ <NuxtLink v-else class="item" :to="child.route" :class="{ active: isActive(child.id) }"><i v-html="child.icon" class="icon"></i><span>{{ child.title }}</span></NuxtLink>@@ -24,6 +24,9 @@ import { type Item } from './helpers';import Collapse from './Collapse.vue';defineProps<{ item: Item }>();+const route = useRoute();+const doc_id = computed(() => route.query.doc as string);+const isActive = (id: string) => doc_id.value === id;</script><style lang="scss" scoped>@@ -37,7 +40,6 @@ defineProps<{ item: Item }>();border-radius: 5px;color: var(--font-color);cursor: pointer;- transition: all $transition-duration ease;width: 90%;&:hover,diff --git a/dashboard/components/sidebar/IconApp.vue b/dashboard/components/sidebar/IconApp.vuenew file mode 100644index 00000000..1acf899c--- /dev/null+++ b/dashboard/components/sidebar/IconApp.vue@@ -0,0 +1,6 @@+<template>+ <svg width="25px" style="fill:var(--green)" xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960">+ <path+ d="M600-40q-33 0-56.5-23.5T520-120q0-23 11-41t29-29v-221q-18-11-29-28.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 23-11 40.5T640-411v115l160-53v-62q-18-11-29-28.5T760-480q0-33 23.5-56.5T840-560q33 0 56.5 23.5T920-480q0 23-11 40.5T880-411v119l-240 80v22q18 11 29 29t11 41q0 33-23.5 56.5T600-40ZM160-160v-560 560Zm0 0q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480h280v80H160Z" />+ </svg>+</template>\ No newline at end of filediff --git a/dashboard/components/sidebar/IconClose.vue b/dashboard/components/sidebar/IconClose.vuenew file mode 100644index 00000000..f74d2bfb--- /dev/null+++ b/dashboard/components/sidebar/IconClose.vue@@ -0,0 +1,10 @@+<template>+ <svg class="btn" @click="isOpened = !isOpened" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">+ <path fill-rule="evenodd" clip-rule="evenodd"+ d="M4 5C3.44772 5 3 5.44772 3 6C3 6.55228 3.44772 7 4 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5H4ZM7 12C7 11.4477 7.44772 11 8 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H8C7.44772 13 7 12.5523 7 12ZM13 18C13 17.4477 13.4477 17 14 17H20C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H14C13.4477 19 13 18.5523 13 18Z" />+ </svg>++</template>+<script setup lang="ts">+import { isOpened } from './helpers';+</script>\ No newline at end of filediff --git a/dashboard/components/sidebar/Resizable.vue b/dashboard/components/sidebar/Resizable.vuenew file mode 100644index 00000000..c9ae1b9c--- /dev/null+++ b/dashboard/components/sidebar/Resizable.vue@@ -0,0 +1,96 @@+<template>++ <nav :class="{ open: isOpened }">+ <div :class="['sidebar', isResizing ? 'no-select' : '']">+ <div :style="{ width: panewidthCSS }">+ <slot></slot>++ </div>+ <div class="separator" @mousedown="startResize"></div>+ </div>+ </nav>+</template>++<script setup lang="ts">+import { isOpened, paneWidth } from "./helpers";++const isResizing = ref(false)+const startX = ref(0)+const startWidth = ref(0)+const panewidthCSS = computed(() => `${paneWidth.value}px`)++// Open and close sidebar from parent component+function startResize(event: MouseEvent) {+ if (event.button !== 0 || event.buttons > 1) return; // only main (left) mouse button is allowed+ isResizing.value = true;+ startX.value = event.pageX;+ startWidth.value = paneWidth.value;++ document.addEventListener('mousemove', resize);+ document.addEventListener('mouseup', stopResize);+}+function resize(event: MouseEvent) {+ if (event.buttons === 0 || !isResizing.value) return stopResize();+ const deltaX = event.pageX - startX.value;+ let newWidth = startWidth.value + deltaX;+ //if (newWidth < minWidth) newWidth = minWidth;+ //else if (newWidth > maxWidth) newWidth = maxWidth;+ paneWidth.value = newWidth;+}+function stopResize() {+ isResizing.value = false;+ document.removeEventListener('mousemove', resize);+ document.removeEventListener('mouseup', stopResize);+}+++++</script>++<style scoped lang="scss">+nav {+ position: fixed;+ top: 0;+ left: 0;+ transition: transform 0.3s;+ transform: translate(-100%);+ height: 100%;+ z-index: 100;+}++.sidebar {+ background-color: var(--bg-contrast);+ overflow-x: hidden;+ height: 100%;+ display: flex;++}++.open {+ transform: translate(0);+}++.separator {+ width: 5px;+ cursor: col-resize;+}++.sidebar {+ &:hover {+ .separator {+ background-color: var(--bg-contrast-2);+ }+ }+}++/* Disable text selection while resizing */+/* Selection can cause problems with selection */+/* PREVENT SELECTION DURING MOUSE EVENTS */+.no-select {+ user-select: none;+ -moz-user-select: none;+ -webkit-user-select: none;+ -ms-user-select: none;+}+</style>\ No newline at end of filediff --git a/dashboard/components/sidebar/Sidebar.vue b/dashboard/components/sidebar/Sidebar.vueindex b37b8f0c..9666ac38 100644--- a/dashboard/components/sidebar/Sidebar.vue+++ b/dashboard/components/sidebar/Sidebar.vue@@ -1,66 +1,27 @@<template>- <nav :class="{ open: isOpened }">- <div :class="['sidebar', isResizing ? 'no-select' : '']">- <div :style="{ width: panewidthCSS }">- <div class="sidebar-content">- <section class="header">- <svg class="btn" @click="logout" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960"- width="24">- <path- d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h280v80H200Zm440-160-55-58 102-102H360v-80h327L585-622l55-58 200 200-200 200Z" />- </svg>- <p class="name">Alexandrie</p>- <svg class="btn" @click="isOpened = !isOpened" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">- <path fill-rule="evenodd" clip-rule="evenodd"- d="M4 5C3.44772 5 3 5.44772 3 6C3 6.55228 3.44772 7 4 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5H4ZM7 12C7 11.4477 7.44772 11 8 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H8C7.44772 13 7 12.5523 7 12ZM13 18C13 17.4477 13.4477 17 14 17H20C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H14C13.4477 19 13 18.5523 13 18Z" />- </svg>- </section>- <section class="body">- <CollapseItem v-for="(item, index) in items" :key="index" :item="item" />- </section>- </div>-- </div>- <div class="separator" @mousedown="startResize"></div>+ <Resizable class="no-print">+ <div class="sidebar-content">+ <section class="header">+ <IconApp />+ <p style="font-size: 19px;font-weight: 600;">Dashboard</p>+ <IconClose class="btn" />+ </section>+ <section>+ <CollapseItem v-for="(item, index) in items" :key="index" :item="item" />+ </section></div>- </nav>+ </Resizable>+</template><script setup lang="ts">import CollapseItem from './CollapseItem.vue';-import { useCategoriesStore, useNotifications, useDocumentsStore, type Document } from '~/store';-import { isOpened, type Item, defaultItems, hasSidebar, paneWidth } from "./helpers";--const isResizing = ref(false)-const startX = ref(0)-const startWidth = ref(0)-const panewidthCSS = computed(() => `${paneWidth.value}px`)--// Open and close sidebar from parent component-function startResize(event: MouseEvent) {- if (event.button !== 0 || event.buttons > 1) return; // only main (left) mouse button is allowed- isResizing.value = true;- startX.value = event.pageX;- startWidth.value = paneWidth.value;-- document.addEventListener('mousemove', resize);- document.addEventListener('mouseup', stopResize);-}-function resize(event: MouseEvent) {- if (event.buttons === 0 || !isResizing.value) return stopResize();- const deltaX = event.pageX - startX.value;- let newWidth = startWidth.value + deltaX;- //if (newWidth < minWidth) newWidth = minWidth;- //else if (newWidth > maxWidth) newWidth = maxWidth;- paneWidth.value = newWidth;-}-function stopResize() {- isResizing.value = false;- document.removeEventListener('mousemove', resize);- document.removeEventListener('mouseup', stopResize);-}-+import Resizable from './Resizable.vue';+import IconClose from './IconClose.vue';+import IconApp from './IconApp.vue';+import { useCategoriesStore, useDocumentsStore, type Document } from '~/store';+import { isOpened, type Item, defaultItems, hasSidebar } from "./helpers";const isMobile = () => process.client ? window.innerWidth <= 768 : false;const handleClickOutside = (e: MouseEvent) => {@@ -70,10 +31,10 @@ const categoriesStore = useCategoriesStore();const documentsStore = useDocumentsStore();const items = computed((): Item[] => [...defaultItems,- ...formatCategoriesToItems()+ ...formatTree()]);-function formatCategoriesToItems(): Item[] {+function formatTree(): Item[] {const parents = categoriesStore.getParents;const items: Item[] = [];parents.forEach((parent) => {@@ -105,7 +66,7 @@ function documentsToItems(documents: Document[]): Item[] {id: document.id,title: document.name,icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--yellow);" d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',- route: `/dashboard/?doc=${document.id}`,+ route: `/dashboard?doc=${document.id}`,childrens: []});});@@ -130,67 +91,8 @@ watch(isOpened, (val) => {if (process.client && val && isMobile()) document.getElementById('backdrop')?.classList.add('backdrop');if (process.client && !val && isMobile()) document.getElementById('backdrop')?.classList.remove('backdrop');});--function logout() {- fetch(`${import.meta.env.VITE_BASE_API}/api/v1/auth/disconnection`, { credentials: "include" })- .then(() => {- const router = useRouter();- useNotifications().add({ type: 'info', title: "Success", message: 'You are now disconnected', timeout: 5000 });- router.push('/login');- })- .catch(() => {- useNotifications().add({ type: 'error', title: "Error", message: 'An error occured', timeout: 5000 });- });-}--</script><style scoped lang="scss">-@import "./sidebar.scss";--nav {- position: fixed;- top: 0;- left: 0;- transition: transform 0.3s;- transform: translate(-100%);- height: 100%;- z-index: 100;-}--.sidebar {- background-color: var(--bg-contrast);- overflow-x: hidden;- height: 100%;- display: flex;--}--.open {- transform: translate(0);-}--.separator {- width: 5px;- cursor: col-resize;-}--.sidebar {- &:hover {- .separator {- background-color: var(--bg-contrast-2);- }- }-}--/* Disable text selection while resizing */-/* Selection can cause problems with selection */-/* PREVENT SELECTION DURING MOUSE EVENTS */-.no-select {- user-select: none;- -moz-user-select: none;- -webkit-user-select: none;- -ms-user-select: none;-}+@import "./__sidebar.scss";</style>\ No newline at end of filediff --git a/dashboard/components/sidebar/sidebar.scss b/dashboard/components/sidebar/__sidebar.scsssimilarity index 69%rename from dashboard/components/sidebar/sidebar.scssrename to dashboard/components/sidebar/__sidebar.scssindex 12d3f601..c23871f9 100644--- a/dashboard/components/sidebar/sidebar.scss+++ b/dashboard/components/sidebar/__sidebar.scss@@ -1,6 +1,3 @@-// Variables-$sidebar-icon-size: 22px;-// Sidebar.sidebar-content {margin: 0 5px 0 10px;@@ -8,7 +5,6 @@ $sidebar-icon-size: 22px;display: flex;flex-direction: column;height: 100%;- overflow-x: hidden;overflow-y: auto;}@@ -18,8 +14,8 @@ $sidebar-icon-size: 22px;display: flex;justify-content: space-between;align-items: center;- height: 40px;- margin-top: 5px;+ height: 50px;+ margin: 10px 0 15px 0;.btn {fill: var(--font-color);@@ -34,7 +30,5 @@ $sidebar-icon-size: 22px;}.body {- display: flex;- flex-direction: column;margin: 5px;}\ No newline at end of filediff --git a/dashboard/components/sidebar/helpers.ts b/dashboard/components/sidebar/helpers.tsindex cf22007e..75091dc4 100644--- a/dashboard/components/sidebar/helpers.ts+++ b/dashboard/components/sidebar/helpers.ts@@ -2,7 +2,7 @@ import { ref } from 'vue';export const isOpened = ref(false);export const hasSidebar = ref(false);-export const paneWidth = ref(330); // initial width of pane 1+export const paneWidth = ref(335); // initial width of pane 1export interface Item {id: string;title: string;@@ -13,52 +13,9 @@ export interface Item {export const defaultItems: Item[] = [{- id: '#0',- title: 'Navigation',+ id: '#1',+ title: 'Navigattion',icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-160q-117 0-198.5-81.5T40-440q0-107 70.5-186.5T287-718l-63-66 56-56 160 160-160 160-56-57 59-59q-71 14-117 69t-46 127q0 83 58.5 141.5T320-240h120v80H320Zm200-360v-280h360v280H520Zm0 360v-280h360v280H520Zm80-80h200v-120H600v120Z"/></svg>',- route: '/',- childrens: [- {- id: '',- title: 'All notes',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>',- route: '/dashboard/?category&filter',- childrens: [],- },- {- id: 'uncategorized',- title: 'Uncategorized',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m738-336-58-58 62-86-142-200H394l-80-80h286q20 0 37 8.5t29 25.5l174 246-102 144Zm54 280L638-210q-9 5-18 7.5t-20 2.5H200q-33 0-56.5-23.5T120-280v-400q0-11 2.5-20t7.5-18l-74-74 56-56 736 736-56 56ZM383-464Zm154-73Zm31 257L200-648v368h368Z"/></svg>',- route: '/dashboard/?category=uncategorized',- childrens: [],- },- {- id: 'archive',- title: 'Archive',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M640-480v-80h80v80h-80Zm0 80h-80v-80h80v80Zm0 80v-80h80v80h-80ZM447-640l-80-80H160v480h400v-80h80v80h160v-400H640v80h-80v-80H447ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80v-480 480Z"/></svg>',- route: '/dashboard/?category=archive',- childrens: [],- },- {- id: 'drafts',- title: 'Drafts',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',- route: '/dashboard/?category=draft',- childrens: [],- },- {- id: 'trash',- title: 'Trash',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>',- route: '/dashboard/?category=trash',- childrens: [],- },- ],- },- {- id: '#2',- title: 'Settings',- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/></svg>',route: '/dashboard/scategory&ettings',childrens: [{@@ -82,6 +39,13 @@ export const defaultItems: Item[] = [route: '/dashboard/backup',childrens: [],},+ {+ id: 'new-page',+ title: 'New page',+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-160h160v-80H520v-160h-80v160H280v80h160v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>',+ route: '/dashboard/new',+ childrens: [],+ },],},];diff --git a/dashboard/middleware/route.global.ts b/dashboard/middleware/route.global.tsdeleted file mode 100644index e8391355..00000000--- a/dashboard/middleware/route.global.ts+++ /dev/null@@ -1,9 +0,0 @@-export default defineNuxtRouteMiddleware((to, from) => {- const mergedQuery = { ...from.query, ...to.query };- if (JSON.stringify(to.query) !== JSON.stringify(mergedQuery)) {- return navigateTo({- path: to.path,- query: mergedQuery,- });- }-});diff --git a/dashboard/nuxt.config.ts b/dashboard/nuxt.config.tsindex 860bc4bd..b88f1c44 100644--- a/dashboard/nuxt.config.ts+++ b/dashboard/nuxt.config.ts@@ -33,7 +33,7 @@ export default defineNuxtConfig({app: {head: {- title: 'Alexandrie',+ title: 'Alexandrie dashboard',viewport: 'width=device-width, initial-scale=1',charset: 'utf-8',htmlAttrs: {diff --git a/dashboard/pages/dashboard/edit.vue b/dashboard/pages/dashboard/edit.vueindex e84ac131..671b5cc6 100644--- a/dashboard/pages/dashboard/edit.vue+++ b/dashboard/pages/dashboard/edit.vue@@ -35,6 +35,7 @@ function save(doc: Document) {<style lang="scss" scoped>.edit-component {width: 100%;+ height: 100%;padding: 12px;}</style>\ No newline at end of filediff --git a/dashboard/pages/dashboard/index.vue b/dashboard/pages/dashboard/index.vueindex 144672fc..3ac0904f 100644--- a/dashboard/pages/dashboard/index.vue+++ b/dashboard/pages/dashboard/index.vue@@ -1,3 +1,90 @@<template>- <Preview />+ <div v-if="doc" style="position: relative;">+ <div class="header">+ <NuxtLink :to="'/dashboard/edit?doc=' + doc.id">+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">+ <path+ d="m640-360 120-120-42-43-48 48v-125h-60v125l-48-48-42 43 120 120ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm0 0v-480 480Zm60-120h60v-180h40v120h60v-120h40v180h60v-200q0-17-11.5-28.5T440-600H260q-17 0-28.5 11.5T220-560v200Z" />+ </svg>+ </NuxtLink>++ <NuxtLink :to="'/dashboard/edit?doc=' + doc.id">+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">+ <path+ d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />+ </svg>+ </NuxtLink>+ <NuxtLink @click="print">+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">+ <path+ d="M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z" />+ </svg>+ </NuxtLink>+ <NuxtLink @click="showDeleteModal = true">++ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">+ <path+ d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z" />+ </svg>+ </NuxtLink>+ <Modal :show="showDeleteModal" @close="showDeleteModal = false" @confirm="deleteDoc">+ <template #header>+ <h3>Delete document</h3>+ </template>+ <template #body>+ <p>Are you sure you want to delete this document?</p>+ </template>+ <template #footer>+ <p style="opacity: 0.7; ">This action is irreversible</p>+ </template>+ </Modal>+ </div>+ <div class="document-theme" v-html="doc.content_html"></div>+ </div>+ <div v-else-if="!doc_id">+ <div style="width: 300px; height: 300px;margin:25vh auto;">+ <img :src="`/empty-${colorMode.value}.png`" />+ </div>+ </div></template>+<script setup lang="ts">+import { useDocumentsStore, type Document } from '~/store';+import { useRoute } from "vue-router";++const route = useRoute();+const doc_id = computed(() => route.query.doc as string);+const doc = ref<Document>();+const documentsStore = useDocumentsStore();+const showDeleteModal = ref(false);+const colorMode = useColorMode()++watchEffect(async () => {+ const docFromStore = documentsStore.getById(doc_id.value);+ if (docFromStore?.partial) {+ try {+ doc.value = await documentsStore.fetch({ id: doc_id.value as string });+ } catch (error) {+ console.error("Error fetching document:", error);+ }+ } else doc.value = docFromStore;+});++const print = () => window.print();+const deleteDoc = () => doc.value?.id ? documentsStore.delete(doc.value.id) : null;+</script>++<style lang="scss" scoped>+.header {+ display: flex;+ justify-content: flex-end;+ align-items: center;+ position: absolute;+ top: -67px;++ svg {+ cursor: pointer;+ fill: $primary-400;+ margin-left: 15px;+ }+}+</style>\ No newline at end of filediff --git a/dashboard/pages/index.vue b/dashboard/pages/index.vueindex f2158cdf..6013e708 100644--- a/dashboard/pages/index.vue+++ b/dashboard/pages/index.vue@@ -1,3 +1,4 @@+<template></template><script setup lang="ts">useRouter().push({ path: "/dashboard" })</script>\ No newline at end of filediff --git a/dashboard/public/empty-dark.png b/dashboard/public/empty-dark.pngnew file mode 100644index 00000000..6349df5cBinary files /dev/null and b/dashboard/public/empty-dark.png differdiff --git a/dashboard/public/empty-light.png b/dashboard/public/empty-light.pngnew file mode 100644index 00000000..3875ded0Binary files /dev/null and b/dashboard/public/empty-light.png differ