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.

New navigation system

Smaug67391bcd63f6f2da
diff --git a/frontend/components/DHeader.vue b/frontend/components/DHeader.vue
new file mode 100644
index 00000000..72eb83a5
--- /dev/null
+++ b/frontend/components/DHeader.vue
@@ -0,0 +1,60 @@
+<template>
+ <nav aria-label="breadcrumb">
+ <ol class="breadcrumb">
+ <li v-for="(segment, index) in breadcrumbs" :key="index" class="breadcrumb-item">
+ <NuxtLink :to="segment.path"> {{ segment.name }} </NuxtLink>
+ </li>
+ </ol>
+ </nav>
+</template>
+
+<script setup lang="ts">
+import type { RouteLocation } from 'vue-router';
+
+const route: RouteLocation = useRoute();
+const router = useRouter();
+const breadcrumbs: Ref<Array<{ name: string, path: string }>> = ref([]);
+declare module 'vue-router' {
+ interface RouteMeta {
+ breadcrumb: () => string;
+ }
+}
+
+watchEffect(() => {
+ breadcrumbs.value = [];
+ console.log(route.matched);
+ route.matched.forEach((match) => {
+ let name = '';
+ if (typeof match.meta.breadcrumb == 'function') name = match.meta.breadcrumb();
+ else if (typeof match.meta.breadcrumb == 'string') name = match.meta.breadcrumb;
+ if (!name) return;
+ const r = router.resolve(match);
+ breadcrumbs.value.push({
+ name,
+ path: r.path
+ });
+ });
+
+})
+</script>
+
+<style scoped>
+.breadcrumb {
+ display: flex;
+ flex-wrap: wrap;
+ padding: 0;
+ list-style: none;
+ border-radius: 0.25rem;
+ font-family: Inter;
+}
+
+.breadcrumb-item+.breadcrumb-item::before {
+ content: "/";
+ padding: 0 0.5rem;
+}
+
+.breadcrumb-item a {
+ font-size: 20px;
+ font-weight: 600;
+}
+</style>
diff --git a/frontend/components/DocumentCardFooter.vue b/frontend/components/DocumentCardFooter.vue
index fcbb5de8..2d383fee 100644
--- a/frontend/components/DocumentCardFooter.vue
+++ b/frontend/components/DocumentCardFooter.vue
@@ -1,7 +1,7 @@
<template>
<footer>
<div class="infos">
- <NuxtLink :to="`/dashboard/doc/edit/${document.id}`"><svg xmlns="http://www.w3.org/2000/svg" height="24"
+ <NuxtLink :to="`/dashboard/docs/edit/${document.id}`"><svg xmlns="http://www.w3.org/2000/svg" height="24"
viewBox="0 -960 960 960" width="24">
<path
d="M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h405l-60 60H180v600h600v-348l60-60v408q0 24-18 42t-42 18H180Zm300-360ZM360-360v-170l382-382q9-9 20-13t22-4q11 0 22.317 4.5T827-911l83 84q8.609 8.958 13.304 19.782Q928-796.394 928-785.197q0 11.197-4.5 22.697T910-742L530-360H360Zm508-425-84-84 84 84ZM420-420h85l253-253-43-42-43-42-252 251v86Zm295-295-43-42 43 42 43 42-43-42Z" />
@@ -9,11 +9,11 @@
<p>Last update: {{ new Date(parseInt(document.updated_timestamp)).toLocaleDateString() }}</p>
</div>
<div class="items">
- <NuxtLink v-if="previous" :to="`/dashboard/doc/${previous.id}`" class="item left">
+ <NuxtLink v-if="previous" :to="`/dashboard/docs/${previous.id}`" class="item left">
<b class="min">Page précédente</b>
{{ previous.name }}
</NuxtLink>
- <NuxtLink v-if="next" :to="`/dashboard/doc/${next.id}`" class="item right">
+ <NuxtLink v-if="next" :to="`/dashboard/docs/${next.id}`" class="item right">
<b class="min">Page suivante</b>
{{ next.name }}
</NuxtLink>
diff --git a/frontend/components/DocumentCardHeaderActionRow.vue b/frontend/components/DocumentCardHeaderActionRow.vue
index 4010e013..6eb4ec79 100644
--- a/frontend/components/DocumentCardHeaderActionRow.vue
+++ b/frontend/components/DocumentCardHeaderActionRow.vue
@@ -1,6 +1,6 @@
<template>
<span class="header">
- <NuxtLink :to="`/dashboard/doc/edit/${doc_id}`">
+ <NuxtLink :to="`/dashboard/docs/edit/${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" />
diff --git a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
index 71247397..80e44487 100644
--- a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
@@ -45,7 +45,7 @@ function exec(action: string) {
editor.format(action);
switch (action) {
case 'exit':
- useRouter().push(document.value.id ? `/dashboard/doc/${document.value.id}` : '/dashboard');
+ useRouter().push(document.value.id ? `/dashboard/docs/${document.value.id}` : '/dashboard');
break;
case 'preview':
editor.showPreview.value = !editor.showPreview.value;
diff --git a/frontend/components/Navbar.vue b/frontend/components/Navbar.vue
index 7bb365ec..ac9b3ecb 100644
--- a/frontend/components/Navbar.vue
+++ b/frontend/components/Navbar.vue
@@ -6,16 +6,7 @@
<path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z" />
</svg>
</button>
- <!--<button @click="previous" class="no-mobile">
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
- <path d="M400-80 0-480l400-400 71 71-329 329 329 329-71 71Z" />
- </svg>
- </button>
- <button @click="next" class="no-mobile">
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
- <path d="m321-80-71-71 329-329-329-329 71-71 400 400L321-80Z" />
- </svg>
- </button>-->
+ <DHeader />
</div>
<ThemeToggle />
</header>
@@ -23,10 +14,13 @@
<style lang="scss" scoped>
header {
- height: 60px;
+ height: 50px;
width: 100%;
display: flex;
justify-content: space-between;
+ align-items: center;
+ border-bottom: 1px solid var(--border-color);
+ margin-bottom: 15px;
}
.container {
@@ -43,7 +37,7 @@ svg {
}
button {
- padding: 5px 0;
+ padding: 0;
margin: 0
}
diff --git a/frontend/components/sidebar/Search.vue b/frontend/components/sidebar/Search.vue
index 216f5f4e..af07628c 100644
--- a/frontend/components/sidebar/Search.vue
+++ b/frontend/components/sidebar/Search.vue
@@ -18,7 +18,7 @@
</button>
</span>
<span class="title">Documents</span>
- <NuxtLink v-if="docs.length" v-for="doc of docs" class="item" :to="`/dashboard/doc/${doc.id}`" @click="close">
+ <NuxtLink v-if="docs.length" v-for="doc of docs" class="item" :to="`/dashboard/docs/${doc.id}`" @click="close">
<i class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
diff --git a/frontend/components/sidebar/Sidebar.vue b/frontend/components/sidebar/Sidebar.vue
index 465763dc..9f9c974a 100644
--- a/frontend/components/sidebar/Sidebar.vue
+++ b/frontend/components/sidebar/Sidebar.vue
@@ -43,7 +43,7 @@ const items = computed((): Item[] => {
id: category.id,
parent_id: category.parent_id || '',
title: category.name,
- route: category.parent_id ? `/dashboard/category/${category.id}` : '',
+ route: category.parent_id ? `/dashboard/categories/${category.id}` : '',
icon: category.icon,
data: category,
}))
@@ -51,7 +51,7 @@ const items = computed((): Item[] => {
id: document.id,
parent_id: document.parent_id || document.category || '',
title: document.name,
- route: `/dashboard/doc/${document.id}`,
+ route: `/dashboard/docs/${document.id}`,
data: document
})).filter(c => c.data.name.toLowerCase().includes(filter.value.toLowerCase()));
diff --git a/frontend/components/sidebar/SidebarItem.vue b/frontend/components/sidebar/SidebarItem.vue
index 3f9ede64..f50db2a1 100644
--- a/frontend/components/sidebar/SidebarItem.vue
+++ b/frontend/components/sidebar/SidebarItem.vue
@@ -112,7 +112,7 @@ const drop = async (event: DragEvent) => {
width: 98%;
&:hover,
- &.router-link-active {
+ &.router-link-exact-active {
background: var(--bg-contrast-2);
}
diff --git a/frontend/components/sidebar/helpers.ts b/frontend/components/sidebar/helpers.ts
index f7f80aa5..81c7de62 100644
--- a/frontend/components/sidebar/helpers.ts
+++ b/frontend/components/sidebar/helpers.ts
@@ -45,7 +45,7 @@ export const navigationItems: DefaultItem[] = [
type: 'default',
title: 'New page',
icon: '<svg style="fill:var(--blue)" 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',
+ route: '/dashboard/docs/new',
childrens: [],
},
];
@@ -59,10 +59,10 @@ export const icons = {
'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" ><path style="fill:var(--green);" d="M320-320h200v-200H320v200Zm0-280h480v-200H320v200Zm280 280h200v-200H600v200Zm-280 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z"/></svg>',
archive:
'<svg style="width:22px;height: 22px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none">\n' +
- '<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/>\n' +
- '<rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
- '<rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
- '<rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
- '<rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
- '</svg>',
+ '<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/>\n' +
+ '<rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
+ '<rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
+ '<rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
+ '<rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/>\n' +
+ '</svg>',
};
diff --git a/frontend/composables/utils.ts b/frontend/composables/utils.ts
index 89f1286e..568ec1d2 100644
--- a/frontend/composables/utils.ts
+++ b/frontend/composables/utils.ts
@@ -64,3 +64,28 @@ export function logOut() {
if (!import.meta.client) return;
localStorage.removeItem('isLoggedIn');
}
+
+export const useBreadcrumbs = () => {
+ const route = useRoute();
+
+ const breadcrumbs: Ref<Array<{ name: string; path: string }>> = ref([]);
+
+ watch(
+ () => ({
+ path: route.path,
+ name: route.meta.title,
+ meta: route.meta,
+ matched: route.matched,
+ }),
+ r => {
+ console.log(r.name);
+ },
+ {
+ immediate: true,
+ },
+ );
+
+ return {
+ breadcrumbs,
+ };
+};
diff --git a/frontend/pages/dashboard.vue b/frontend/pages/dashboard.vue
index e3823fc4..e921c4e2 100644
--- a/frontend/pages/dashboard.vue
+++ b/frontend/pages/dashboard.vue
@@ -9,4 +9,7 @@
</template>
<script setup lang="ts">
import Sidebar from '~/components/sidebar/Sidebar.vue';
+definePageMeta({
+ breadcrumb: () => 'Dashboard'
+});
</script>
\ No newline at end of file
diff --git a/frontend/pages/dashboard/backup.vue b/frontend/pages/dashboard/backup.vue
index d0237957..2de32714 100644
--- a/frontend/pages/dashboard/backup.vue
+++ b/frontend/pages/dashboard/backup.vue
@@ -19,6 +19,7 @@ import { useNotifications } from '~/store';
const downloadLink = ref<string | null>(null);
const copyLink = () => navigator.clipboard.writeText(downloadLink.value!);
const isLoading = ref(false);
+definePageMeta({ breadcrumb: 'Backup' });
async function submitFile() {
isLoading.value = true;
diff --git a/frontend/pages/dashboard/categories.vue b/frontend/pages/dashboard/categories.vue
new file mode 100644
index 00000000..ac64f914
--- /dev/null
+++ b/frontend/pages/dashboard/categories.vue
@@ -0,0 +1,9 @@
+<template>
+ <NuxtPage />
+</template>
+
+<script setup lang="ts">
+definePageMeta({
+ breadcrumb: () => "Categories"
+});
+</script>
diff --git a/frontend/pages/dashboard/category/[id].vue b/frontend/pages/dashboard/categories/[id].vue
similarity index 62%
rename from frontend/pages/dashboard/category/[id].vue
rename to frontend/pages/dashboard/categories/[id].vue
index 7f9ed12e..b9de0c8a 100644
--- a/frontend/pages/dashboard/category/[id].vue
+++ b/frontend/pages/dashboard/categories/[id].vue
@@ -1,33 +1,30 @@
<template>
- <div>
- <h1>Documents de la catégorie {{ category?.name }}</h1>
- <div class="document-list">
- <div v-for="document in documents" :key="document.id" class="document-card">
- <div>
- <header class="document-header">
- <i v-html="category?.icon" class="category-icon"></i>
- <NuxtLink :to="`/dashboard/doc/${document.id}`" class="document-title"
- :style="`border-bottom: 2px solid ${useColorHash(document.id)};`">{{ document.name }}</NuxtLink>
- </header>
- <p class="document-description">{{ document.description }}</p>
+ <div class="document-list">
+ <div v-for="document in documents" :key="document.id" class="document-card">
+ <div>
+ <header class="document-header">
+ <i v-html="category?.icon" class="category-icon"></i>
+ <NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title"
+ :style="`border-bottom: 2px solid ${useColorHash(document.id)};`">{{ document.name }}</NuxtLink>
+ </header>
+ <p class="document-description">{{ document.description }}</p>
+ </div>
+ <div class="document-tags" v-if="document.tags">
+ <span v-for="tag in document.tags.split(',')" :key="tag" class="tag">{{ tag.trim() }}</span>
+ </div>
+ <footer class="document-footer">
+ <div class="footer-item">
+ <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"
+ fill="var(--font-color)">
+ <path
+ d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z" />
+ </svg>
+ <span>{{ formatDate(parseInt(document.created_timestamp)) }}</span>
</div>
- <div class="document-tags" v-if="document.tags">
- <span v-for="tag in document.tags.split(',')" :key="tag" class="tag">{{ tag.trim() }}</span>
+ <div class="footer-item">
+ <span>Mis à jour: {{ formatDate(parseInt(document.updated_timestamp)) }}</span>
</div>
- <footer class="document-footer">
- <div class="footer-item">
- <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"
- fill="var(--font-color)">
- <path
- d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z" />
- </svg>
- <span>{{ formatDate(parseInt(document.created_timestamp)) }}</span>
- </div>
- <div class="footer-item">
- <span>Mis à jour: {{ formatDate(parseInt(document.updated_timestamp)) }}</span>
- </div>
- </footer>
- </div>
+ </footer>
</div>
</div>
</template>
@@ -39,6 +36,12 @@ const categoriesStore = useCategoriesStore();
const documentsStore = useDocumentsStore();
const category = computed(() => categoriesStore.getById(route.params.id as string));
+definePageMeta({
+ breadcrumb: () => {
+ const category = useCategoriesStore().getById(useRoute().params.id as string);
+ return category?.name || '';
+ }
+});
const documents = computed(() => {
const documents = documentsStore.getByCategories(category.value?.id || '');
const childCategories = categoriesStore.getChilds(category.value?.id || '');
@@ -47,8 +50,8 @@ const documents = computed(() => {
documents.push(...childDocuments);
}
return documents;
-});
+});
// Output ex: 10 Jan 2021
function formatDate(timestamp: number): string {
const date = new Date(timestamp);
diff --git a/frontend/pages/dashboard/categories/edit.vue b/frontend/pages/dashboard/categories/edit.vue
index 5c2117db..582aadd8 100644
--- a/frontend/pages/dashboard/categories/edit.vue
+++ b/frontend/pages/dashboard/categories/edit.vue
@@ -46,6 +46,7 @@ const categoriesStore = useCategoriesStore();
const category = computed(() => categoriesStore.getById(categoryId as string) || { id: '', name: '', icon: '', parent_id: '', order: 0, type: 'category' as const });
const categoryId = route.query.category;
+definePageMeta({ breadcrumb: 'Edit' });
const updateCategory = async () => {
if (category.value) categoriesStore.update(category.value)
diff --git a/frontend/pages/dashboard/categories/new.vue b/frontend/pages/dashboard/categories/new.vue
index 96ffe05c..1d2649d9 100644
--- a/frontend/pages/dashboard/categories/new.vue
+++ b/frontend/pages/dashboard/categories/new.vue
@@ -34,7 +34,8 @@
import { type Category, useCategoriesStore, useNotifications } from '~/store';
const categoriesStore = useCategoriesStore();
-const category = ref<Category>({ id: '', name: '', icon: '', parent_id: '', order: 0 });
+const category = ref<Category>({ id: '', name: '', icon: '', parent_id: '', order: 0, type: 'category' });
+definePageMeta({ breadcrumb: 'New' });
const createCategory = async () => {
categoriesStore.post(category.value)
diff --git a/frontend/pages/dashboard/cdn.vue b/frontend/pages/dashboard/cdn.vue
index bbbafcd2..666b6274 100644
--- a/frontend/pages/dashboard/cdn.vue
+++ b/frontend/pages/dashboard/cdn.vue
@@ -49,6 +49,7 @@ const isLoading = ref(false);
const ressources = ressourcesStore.ressources;
const triggerFileSelect = () => fileInput.value!.click();
const handleFileSelect = (event: Event) => selectedFile.value = (event.target as HTMLInputElement | null)?.files?.[0] || null;
+definePageMeta({ breadcrumb: 'CDN' });
const handleFileDrop = (event: DragEvent) => {
if (event.dataTransfer?.files && event.dataTransfer.files.length > 0) {
diff --git a/frontend/pages/dashboard/docs.vue b/frontend/pages/dashboard/docs.vue
new file mode 100644
index 00000000..01c45b04
--- /dev/null
+++ b/frontend/pages/dashboard/docs.vue
@@ -0,0 +1,9 @@
+<template>
+ <NuxtPage />
+</template>
+
+<script setup lang="ts">
+definePageMeta({
+ breadcrumb: () => "Documents"
+});
+</script>
diff --git a/frontend/pages/dashboard/doc/[id].vue b/frontend/pages/dashboard/docs/[id].vue
similarity index 92%
rename from frontend/pages/dashboard/doc/[id].vue
rename to frontend/pages/dashboard/docs/[id].vue
index 18569333..6649961e 100644
--- a/frontend/pages/dashboard/doc/[id].vue
+++ b/frontend/pages/dashboard/docs/[id].vue
@@ -39,6 +39,13 @@ watchEffect(async () => {
useHead({ title: `Alexandrie ${article.value?.name || ''}` });
});
+definePageMeta({
+ breadcrumb: () => {
+ const doc = useDocumentsStore().getById(useRoute().params.id as string);
+ return doc?.name || '';
+ }
+});
+
const next = computed(() => documentsStore.getNext(article.value));
const previous = computed(() => documentsStore.getPrevious(article.value));
diff --git a/frontend/pages/dashboard/doc/edit/[id].vue b/frontend/pages/dashboard/docs/edit/[id].vue
similarity index 96%
rename from frontend/pages/dashboard/doc/edit/[id].vue
rename to frontend/pages/dashboard/docs/edit/[id].vue
index d4037ea4..1bc8ead7 100644
--- a/frontend/pages/dashboard/doc/edit/[id].vue
+++ b/frontend/pages/dashboard/docs/edit/[id].vue
@@ -23,6 +23,9 @@ watchEffect(async () => {
}
} else document.value = docFromStore;
});
+
+definePageMeta({ breadcrumb: 'Edit' });
+
function save(doc: Document) {
store.update(doc)
.then(() => notifications.add({ title: "Success:", message: "Document updated", type: "success", timeout: 5000 }))
diff --git a/frontend/pages/dashboard/search.vue b/frontend/pages/dashboard/docs/index.vue
similarity index 80%
rename from frontend/pages/dashboard/search.vue
rename to frontend/pages/dashboard/docs/index.vue
index 230d5c6b..e7c4e5fe 100644
--- a/frontend/pages/dashboard/search.vue
+++ b/frontend/pages/dashboard/docs/index.vue
@@ -18,11 +18,11 @@ const headers = [
const rows = computed(() => documents.value.map((doc) => {
return {
fields: [
- { content: doc.name, action: `/dashboard/doc/${doc.id}` },
- { content: categoriesStore.getById(doc.category || '')?.name || '', action: `/dashboard/category/${doc.category}` },
+ { content: doc.name, action: `/dashboard/docs/${doc.id}` },
+ { content: categoriesStore.getById(doc.category || '')?.name || '', action: `/dashboard/categories/${doc.category}` },
{ content: new Date(parseInt(doc.created_timestamp)).toDateString() },
{ content: new Date(parseInt(doc.updated_timestamp)).toDateString() },
- { content: 'View document', action: `/dashboard/doc/${doc.id}` },
+ { content: 'View document', action: `/dashboard/docs/${doc.id}` },
],
};
}));
diff --git a/frontend/pages/dashboard/new.vue b/frontend/pages/dashboard/docs/new.vue
similarity index 93%
rename from frontend/pages/dashboard/new.vue
rename to frontend/pages/dashboard/docs/new.vue
index 3f7004e8..82f4d293 100644
--- a/frontend/pages/dashboard/new.vue
+++ b/frontend/pages/dashboard/docs/new.vue
@@ -11,6 +11,7 @@ const editor = ref();
const document = ref<Document | undefined>(undefined);
const notifications = useNotifications();
+definePageMeta({ breadcrumb: 'New' });
function save(doc: Document) {
store.post(doc)
diff --git a/frontend/pages/dashboard/edit.vue b/frontend/pages/dashboard/edit.vue
deleted file mode 100644
index 5c779e7b..00000000
--- a/frontend/pages/dashboard/edit.vue
+++ /dev/null
@@ -1,40 +0,0 @@
-<template>
- <div v-if="document" class="edit-component">
- <MarkdownEditor ref="editor" :doc="document" @save="(data) => save(data)" />
- </div>
-</template>
-<script lang="ts" setup>
-import { useNotifications, useDocumentsStore, type Document } from '@/store';
-import MarkdownEditor from '~/components/MarkdownEditor/LazyMarkdownEditor.vue';
-
-const store = useDocumentsStore();
-const route = useRoute();
-
-const editor = ref();
-const doc_id = computed(() => route.query.doc as string);
-const document = ref<Document | undefined>(undefined);
-const notifications = useNotifications();
-
-watchEffect(async () => {
- const docFromStore = store.getById(doc_id.value);
- if (docFromStore?.partial) {
- try {
- document.value = await store.fetch({ id: doc_id.value as string });
- } catch (error) {
- console.error("Error fetching document:", error);
- }
- } else document.value = docFromStore;
-});
-function save(doc: Document) {
- store.update(doc)
- .then(() => notifications.add({ title: "Success:", message: "Document updated", type: "success", timeout: 5000 }))
- .catch((e) => notifications.add({ title: "Error:", message: e, type: "error", timeout: 5000 }))
-}
-
-</script>
-<style lang="scss" scoped>
-.edit-component {
- width: 100%;
- height: 100%;
-}
-</style>
\ No newline at end of file