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 menus, improve UI, material design, new cards

Smaug6739f231114fe32b
diff --git a/frontend/components/AppDotMenu.vue b/frontend/components/AppDotMenu.vue
new file mode 100644
index 00000000..55c1268a
--- /dev/null
+++ b/frontend/components/AppDotMenu.vue
@@ -0,0 +1,87 @@
+<template>
+ <div class="three-dots-menu" ref="menuRoot">
+ <span class="menu-button" @click="toggleMenu" aria-label="Menu">
+ <svg class="menu-icon" viewBox="0 9 20 2" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
+ <path d="M3 10a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm5 0a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zm5 0a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z" />
+ </svg>
+ </span>
+ <transition name="fade-scale">
+ <div v-if="open" class="menu-content">
+ <slot></slot>
+ </div>
+ </transition>
+ </div>
+</template>
+
+<script setup lang="ts">
+const open = ref(false);
+const menuRoot: Ref<HTMLDivElement | undefined> = ref();
+const toggleMenu = () => (open.value = !open.value);
+
+function handleClickOutside(e: MouseEvent) {
+ if (menuRoot.value && !menuRoot.value.contains(e.target as Node)) {
+ open.value = false;
+ }
+}
+const close = () => (open.value = false);
+defineExpose({ close });
+
+onMounted(() => {
+ document.addEventListener('mousedown', handleClickOutside);
+});
+onBeforeUnmount(() => document.removeEventListener('mousedown', handleClickOutside));
+</script>
+
+<style scoped>
+.three-dots-menu {
+ position: relative;
+ display: inline-block;
+}
+
+.menu-button {
+ background: none;
+ border: none;
+ cursor: pointer;
+ padding: 0;
+ border-radius: 4px;
+ line-height: 1;
+}
+
+.menu-button:hover {
+ background-color: rgba(0, 0, 0, 0.08);
+}
+.menu-icon {
+ display: block;
+ height: 20px;
+ width: 20px;
+ margin: auto 0;
+}
+
+.menu-content {
+ position: absolute;
+ right: 0;
+ margin-top: 4px;
+ min-width: 200px;
+ background: white;
+ border-radius: 6px;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+ overflow: hidden;
+ z-index: 2;
+}
+
+/* Animation */
+.fade-scale-enter-active {
+ transition: all 120ms ease-out;
+}
+.fade-scale-leave-active {
+ transition: all 100ms ease-in;
+}
+.fade-scale-enter-from {
+ opacity: 0;
+ transform: scale(0.95);
+}
+.fade-scale-leave-to {
+ opacity: 0;
+ transform: scale(0.95);
+}
+</style>
diff --git a/frontend/components/AppToggle.vue b/frontend/components/AppToggle.vue
index 1e70db3b..bbe02989 100644
--- a/frontend/components/AppToggle.vue
+++ b/frontend/components/AppToggle.vue
@@ -42,7 +42,7 @@ const toggle = () => {
}
&.active {
- background: var(--primary-border);
+ background: var(--primary);
border-color: var(--primary);
.circle {
diff --git a/frontend/components/DocumentCard.vue b/frontend/components/DocumentCard.vue
index baa46735..82c06ebd 100644
--- a/frontend/components/DocumentCard.vue
+++ b/frontend/components/DocumentCard.vue
@@ -1,13 +1,20 @@
<template>
<div class="document-card">
- <header>
- <Icon :name="category(document.category)?.icon || 'files'" :class="`category-icon ${getAppColor(category(document.category)?.color as number) || 'primary'}`" />
- <NuxtLink :to="`/dashboard/docs/${document.id}`" :class="`document-title`" :style="`color: var(--${getAppColor(category(document.category)?.color as number)})`">{{ document.name }}</NuxtLink>
- </header>
- <div class="tags" v-if="document.tags">
- <tag v-for="tag in document.tags.split(',')" :key="tag" class="primary">{{ tag.trim() }}</tag>
+ <div class="top">
+ <div class="header">
+ <span style="display: flex">
+ <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number) || 'primary'}`" /> <NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title">{{ document.name }}</NuxtLink>
+ </span>
+ <DocumentDotMenu :document="document" :user="user" />
+ </div>
+ <div class="body">
+ <div class="category">{{ category?.name }}</div>
+ <div class="tags" v-if="document.tags">
+ <tag v-for="tag in document.tags.split(',')" :key="tag" class="primary">{{ tag.trim() }}</tag>
+ </div>
+ <p class="description" v-text="document.description"></p>
+ </div>
</div>
- <p class="description" v-text="document.description"></p>
<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)">
@@ -26,35 +33,42 @@
<script setup lang="ts">
import type { Document } from '@/stores';
-defineProps<{ document: Document }>();
+const props = defineProps<{ document: Document }>();
const categoriesStore = useCategoriesStore();
-const category = (cat_id?: string) => categoriesStore.getById(cat_id || '');
+const category = computed(() => categoriesStore.getById(props.document.category || ''));
+const user = useUserStore().user;
function formatDate(timestamp: number): string {
const date = new Date(timestamp);
return `${date.getDate()} ${date.toLocaleString('default', { month: 'short' })} ${date.getFullYear()}`;
}
+function numDate(timestamp: string): string {
+ const date = new Date(timestamp);
+ return date.toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ });
+}
</script>
<style scoped lang="scss">
.document-card {
border-radius: 12px;
border: 1px solid var(--border-color);
- box-shadow: 0 2px 10px var(--shadow);
overflow: hidden;
min-width: 340px;
- max-width: 400px;
- height: 400px;
+ max-width: 380px;
+ min-height: 250px;
display: flex;
flex-direction: column;
justify-content: space-between;
- flex: 1;
}
-header {
- background-color: var(--bg-contrast-2);
+.header {
padding: 12px;
display: flex;
align-items: center;
+ justify-content: space-between;
}
.category-icon {
@@ -66,12 +80,17 @@ header {
.document-title {
font-size: 18px;
font-weight: bold;
- text-decoration: none;
+ color: var(--font-color-dark);
+}
+.body {
+ padding: 4px 12px;
+}
+.category {
+ font-size: 15.5px;
+ color: var(--font-color-light);
+ padding-bottom: 8px;
}
-
.description {
- padding: 8px;
- font-size: 16px;
height: 100%;
overflow: hidden;
margin: 0;
@@ -79,18 +98,16 @@ header {
}
.tags {
- padding: 6px 5px;
display: flex;
flex-wrap: wrap;
}
footer {
- padding: 10px;
- background-color: var(--bg-contrast);
+ padding: 6px 12px;
display: flex;
flex-direction: column;
font-size: 14px;
- color: #777;
+ color: var(--font-color-light);
border-top: 1px solid var(--border-color-accent);
}
diff --git a/frontend/components/DocumentDotMenu.vue b/frontend/components/DocumentDotMenu.vue
new file mode 100644
index 00000000..8b92ec7f
--- /dev/null
+++ b/frontend/components/DocumentDotMenu.vue
@@ -0,0 +1,77 @@
+<template>
+ <AppDotMenu ref="dotMenu">
+ <button @click="open"><Icon name="file_open" /> Open</button>
+ <button @click="edit"><Icon name="edit_page" /> Edit</button>
+ <button @click="copyLink"><Icon name="link" /> Copy link</button>
+ <button @click="emitDelete"><Icon name="delete" /> Delete</button>
+ <hr style="margin: 2px 0" />
+ <div class="foot-menu">
+ <p style="display: flex; align-items: center; gap: 8px"><img :src="useAvatar(user)" alt="Avatar" style="width: 20px; height: 20px; border-radius: 50%; margin: 0" />{{ user?.username }}</p>
+ <p>Updated on {{ numericDate(document.updated_timestamp) }}</p>
+ </div>
+ </AppDotMenu>
+</template>
+
+<script setup lang="ts">
+import type { Document, User } from '~/stores';
+
+const dotMenu = ref();
+const props = defineProps<{ document: Document; user?: User }>();
+const emit = defineEmits<{
+ (e: 'open'): void;
+ (e: 'edit'): void;
+ (e: 'rename'): void;
+ (e: 'delete'): void;
+}>();
+defineExpose({ close: () => dotMenu.value?.close() });
+
+const numericDate = (timestamp: string): string => {
+ const date = new Date(timestamp);
+ return date.toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ });
+};
+
+const open = () => useRouter().push(`/dashboard/docs/${props.document.id}`);
+const edit = () => useRouter().push(`/dashboard/docs/edit/${props.document.id}`);
+const copyLink = () => {
+ const link = `${window.location.origin}/dashboard/docs/${props.document.id}`;
+ navigator.clipboard.writeText(link).then(() => {});
+};
+const emitDelete = () => {
+ dotMenu.value?.close();
+ emit('delete');
+};
+</script>
+
+<style scoped lang="scss">
+button {
+ display: flex;
+ align-items: center;
+ padding: 6px 8px;
+ width: 100%;
+ gap: 8px;
+ border: none;
+ background: none;
+ font-size: 14px;
+ font-family: ui-sans-serif, sans-serif;
+ cursor: pointer;
+ color: var(--font-color);
+ &:hover {
+ background-color: var(--bg-contrast);
+ }
+}
+.foot-menu {
+ font-size: 0.85rem;
+ color: var(--font-color-light);
+ padding: 4px 8px;
+ display: flex;
+ flex-direction: column;
+ gap: 5px;
+ p {
+ margin: 0;
+ }
+}
+</style>
diff --git a/frontend/components/DocumentLine.vue b/frontend/components/DocumentLine.vue
new file mode 100644
index 00000000..e74a090b
--- /dev/null
+++ b/frontend/components/DocumentLine.vue
@@ -0,0 +1,81 @@
+<template>
+ <div class="document-line">
+ <header>
+ <div class="category-icon">
+ <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number) || 'primary'}`" />
+ </div>
+
+ <a :href="`/documents/${document.id}`" class="document-title">{{ document.name }}</a>
+ <span class="tags" v-if="document.tags">
+ <tag v-for="tag in document.tags?.split(', ')" :key="tag" class="primary">{{ tag }}</tag>
+ </span>
+ </header>
+ <p class="description">{{ document.description }}</p>
+ <footer>
+ <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 class="date">{{ formatDate(parseInt(document.updated_timestamp)) }}</span>
+ </footer>
+ </div>
+</template>
+
+<script setup lang="ts">
+import type { Document } from '@/stores';
+const props = defineProps<{ document: Document }>();
+const categoriesStore = useCategoriesStore();
+const category = computed(() => categoriesStore.getById(props.document.category || ''));
+function formatDate(timestamp: number): string {
+ const date = new Date(timestamp);
+ return `${date.getDate()} ${date.toLocaleString('default', { month: 'short' })} ${date.getFullYear()}`;
+}
+</script>
+
+<style scoped lang="scss">
+.document-line {
+ display: flex;
+ flex-direction: column;
+ padding: 12px;
+ border-bottom: 1px solid var(--border-color);
+ background-color: var(--bg-contrast);
+}
+header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 6px;
+ justify-content: flex-start;
+ border: none;
+}
+.category-icon {
+ margin-right: 5px;
+ padding: 4px 6px;
+ border-radius: 6px;
+}
+.document-title {
+ margin-right: 5px;
+ font-size: 18px;
+ font-weight: bold;
+ text-decoration: none;
+}
+.description {
+ padding: 4px 0;
+ font-size: 16px;
+ height: 100%;
+ overflow: hidden;
+ margin: 0;
+ text-overflow: ellipsis;
+}
+footer {
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+ font-size: 14px;
+ margin-top: 8px;
+}
+.tags {
+ display: flex;
+ flex-wrap: wrap;
+}
+</style>
diff --git a/frontend/components/Error.vue b/frontend/components/Error.vue
index 77b31ca3..f7b25b44 100644
--- a/frontend/components/Error.vue
+++ b/frontend/components/Error.vue
@@ -17,10 +17,10 @@
</template>
<script setup lang="ts">
-const props = defineProps<{ error: string }>();
+const props = defineProps<{ error?: string }>();
const handleError = computed(() => {
- if (props.error === 'Failed to fetch') return 'Network error, please check your connection.';
+ if (props.error === 'Failed to fetch' || 'TypeError: Failed to fetch') return 'Network error, please check your connection.';
if (props.error === 'Request failed with status code 404') return 'The requested resource was not found.';
if (props.error === 'Request failed with status code 500') return 'Internal server error, please try again later.';
return 'An unexpected error has occurred.';
diff --git a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
index 3cd59d4b..8e683e28 100644
--- a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
@@ -1,8 +1,8 @@
<template>
- <div class="card-component" style="height: 100%">
+ <div style="height: 100%; padding: 4px">
<div class="editor-container">
<Toolbar :document="document" @execute-action="exec" :minimal="minimal" />
- <div style="padding: 6px 12px; flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 8px">
+ <div style="padding: 6px; flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 8px">
<input placeholder="Title" class="title" v-model="document.name" v-if="!minimal" />
<input placeholder="Description" class="description" v-model="document.description" v-if="!minimal" />
<div class="markdown" ref="container">
diff --git a/frontend/components/MarkdownEditor/Toolbar.vue b/frontend/components/MarkdownEditor/Toolbar.vue
index 4b984c96..21906fed 100644
--- a/frontend/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/components/MarkdownEditor/Toolbar.vue
@@ -1,9 +1,9 @@
<template>
<div class="toolbar">
<button v-for="item in toolbar" :key="item.name" v-html="item.icon" @click="emitAction(item.action)" :title="item.name"></button>
- <AppSelect v-model="document.accessibility" :items="accessibilities" placeholder="Access" size="100px" v-if="!minimal" />
- <AppSelect v-model="document.category" :items="categories" placeholder="Select category" size="220px" v-if="!minimal" />
- <input type="text" v-model="document.tags" placeholder="Tags" style="margin-right: 5px" />
+ <AppSelect v-model="document.accessibility" :items="accessibilities" placeholder="Access" size="100px" class="entry" v-if="!minimal" />
+ <AppSelect v-model="document.category" :items="categories" placeholder="Select category" size="220px" class="entry" v-if="!minimal" />
+ <input type="text" v-model="document.tags" placeholder="Tags" class="entry" style="margin-right: 5px" />
<AppHint text="Tags separated with a comma" />
</div>
</template>
@@ -136,4 +136,7 @@ select {
display: inline-block;
max-width: 350px;
}
+.entry {
+ background-color: var(--bg-color);
+}
</style>
diff --git a/frontend/components/Navbar.vue b/frontend/components/Navbar.vue
index 6720604d..fd553e03 100644
--- a/frontend/components/Navbar.vue
+++ b/frontend/components/Navbar.vue
@@ -20,6 +20,7 @@ header {
border-bottom: 1px solid var(--border-color);
margin-bottom: 10px;
padding: 10px 0;
+ position: sticky;
}
svg {
diff --git a/frontend/components/Sidebar/CollapseItem.vue b/frontend/components/Sidebar/CollapseItem.vue
index 6e6f80e2..bd6ae006 100644
--- a/frontend/components/Sidebar/CollapseItem.vue
+++ b/frontend/components/Sidebar/CollapseItem.vue
@@ -11,7 +11,7 @@
</svg>
</SidebarItem>
<SidebarItem v-else :item="item" class="collapse-header" />
- <div v-if="props.item.show.value" class="collapse-body" v-for="child in item.childrens" :key="child.id" style="margin-left: 18px">
+ <div v-if="props.item.show.value" class="collapse-body" v-for="child in item.childrens" :key="child.id" style="margin-left: 15px">
<CollapseItem v-if="child.childrens?.length" :item="child" :root="child.data.type === 'document'" />
<SidebarItem v-else :item="child" />
</div>
diff --git a/frontend/components/Sidebar/Dock.vue b/frontend/components/Sidebar/Dock.vue
index 073d4c6e..a2f3bd37 100644
--- a/frontend/components/Sidebar/Dock.vue
+++ b/frontend/components/Sidebar/Dock.vue
@@ -63,6 +63,6 @@ a.router-link-active {
<script setup lang="ts">
function closeDock() {
- usePreferences().set({ key: 'hideDock', value: false });
+ usePreferences().set('hideDock', false);
}
</script>
diff --git a/frontend/components/Sidebar/Resizable.vue b/frontend/components/Sidebar/Resizable.vue
index 3bae91d3..e2c8fee4 100644
--- a/frontend/components/Sidebar/Resizable.vue
+++ b/frontend/components/Sidebar/Resizable.vue
@@ -69,10 +69,14 @@ nav {
.open {
transform: translate(0);
+ border-radius: 0 15px 15px 0; // arrondi sur le bord droit
+ border-right: 1px solid var(--border-color);
}
.separator {
width: 5px;
+ height: 96%;
+ margin: auto 0;
cursor: col-resize;
}
diff --git a/frontend/components/Sidebar/Sidebar.vue b/frontend/components/Sidebar/Sidebar.vue
index 3ae5b3bd..9b7210db 100644
--- a/frontend/components/Sidebar/Sidebar.vue
+++ b/frontend/components/Sidebar/Sidebar.vue
@@ -6,7 +6,7 @@
<section class="header">
<span class="name">
<IconApp />
- <NuxtLink style="font-size: 19px; font-weight: 600" to="/dashboard">Alexandrie</NuxtLink>
+ <NuxtLink style="font-size: 19px; font-weight: 600; font-family: Arial" to="/dashboard">Alexandrie</NuxtLink>
</span>
<IconClose class="btn" />
</section>
@@ -29,7 +29,7 @@
</div>
<SidebarWorkspaces :options="workspaces" />
<Search />
- <CollapseItem v-for="item in navigationItemsComputed" :key="item.id" :item="item" :root="true" />
+ <CollapseItem v-for="item in navigationItems" :key="item.id" :item="item" :root="true" />
<hr style="margin: 5px 0; width: 100%" />
<CollapseItem v-for="item in tree" :key="item.id" :item="item" :root="true" />
</div>
@@ -57,18 +57,6 @@ const workspaces = computed(() => [{ text: 'All workspaces', value: null }, ...c
const handleSearchShortCut = (e: KeyboardEvent) => {
if (e.ctrlKey && e.key === 'q') showSearchModal.value = !showSearchModal.value;
};
-const navigationItemsComputed = computed<Item[]>(() =>
- navigationItems.map(item => ({
- id: item.id,
- parent_id: '',
- label: item.label,
- route: item.route,
- icon: item.icon,
- type: 'navigation',
- data: item,
- show: ref(true),
- })),
-);
const sidebarTree = useSidebarTree();
const toggleDock = () => preferences.set('hideDock', !preferences.get('hideDock'));
const filterItems = (items: Item[]): Item[] => {
@@ -121,10 +109,8 @@ onBeforeUnmount(() => {
width: 100%;
padding: 0.5rem;
overflow-y: scroll;
- font-family: Inter;
- background-color: var(--bg-color);
- * {
- font-family: Inter;
+ &::-webkit-scrollbar-thumb {
+ background: transparent;
}
}
@@ -173,7 +159,7 @@ onBeforeUnmount(() => {
width: 98%;
outline: none;
background-color: var(--bg-contrast);
- background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="%236024ec" height="24" viewBox="0 -960 960 960" width="22"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>');
+ background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="%235b5967" height="24" viewBox="0 -960 960 960" width="22"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>');
background-repeat: no-repeat;
background-position: 5px;
transition: background-color $transition-duration;
diff --git a/frontend/components/Sidebar/SidebarItem.vue b/frontend/components/Sidebar/SidebarItem.vue
index e74b6093..05ba1036 100644
--- a/frontend/components/Sidebar/SidebarItem.vue
+++ b/frontend/components/Sidebar/SidebarItem.vue
@@ -1,7 +1,8 @@
<template>
- <span class="item" @click="onClick" :draggable="draggable" @dragstart="dragStart" @dragover.prevent="dragOver" @drop="drop" @dragleave="dragLeave" :class="{ 'drag-over': isDragOver }" :key="item.id">
+ <span class="item" @click="onClick" :draggable="true" @dragstart="dragStart" @dragover.prevent="dragOver" @drop="drop" @dragleave="dragLeave" :class="{ 'drag-over': isDragOver }" @mouseleave="closeDotMenu">
<Icon :name="icon" :class="customClass" />&nbsp;
<NuxtLink :to="item.route" style="width: 100%" class="close">{{ item.label }} </NuxtLink>
+ <DocumentDotMenu v-if="item.data.type === 'document'" ref="dotMenu" class="nav close" :document="item.data" :user="user" :mouse-leave="true" @delete="deleteDoc" />
<NuxtLink v-if="item.data.type === 'category'" :to="`/dashboard/categories/${item.id}/edit`" class="nav close"> <Icon name="settings" fill="var(--font-color)" /> </NuxtLink>
<NuxtLink v-if="item.data.type === 'category'" :to="`/dashboard/docs/new?cat=${item.id}`" class="nav close"> <Icon name="plus" fill="var(--font-color)" /> </NuxtLink>
<slot></slot>
@@ -9,20 +10,26 @@
</template>
<script setup lang="ts">
+import DeleteDocumentModal from '~/pages/dashboard/docs/_modals/DeleteDocumentModal.vue';
import { navigationItems } from './helpers';
-
const documentStore = useDocumentsStore();
const categoriesStore = useCategoriesStore();
-
+const user = useUserStore().user;
const { isOpened } = useSidebar();
const props = defineProps<{ item: Item }>();
-const customClass = ref('');
+const dotMenu = ref();
+const customClass = computed(() => {
+ if ('color' in props.item.data && props.item.data.color) return `item-icon ${getAppColor(props.item.data.color as number)}`;
+});
+const closeDotMenu = () => {
+ if (dotMenu.value) dotMenu.value.close();
+};
const icon = computed(() => {
- if ('color' in props.item.data) customClass.value = props.item.data.color ? `item-icon ${getAppColor(props.item.data.color as number)}` : '';
if ('icon' in props.item.data && props.item.data.icon) return props.item.data.icon;
return props.item.icon || '';
});
-const draggable = ref<boolean>(true);
+const deleteDoc = () => useModal().add(new Modal(shallowRef(DeleteDocumentModal), { documentId: props.item.id }));
+
const isDragOver = ref<boolean>(false);
const onClick = (m: MouseEvent) => {
@@ -50,7 +57,7 @@ const drop = async (event: DragEvent) => {
isDragOver.value = false;
const draggedItemId = event.dataTransfer!.getData('text/plain');
- let draggedItem = documentStore.getById(draggedItemId) || categoriesStore.getById(draggedItemId) || navigationItems.find(item => item.id === draggedItemId);
+ let draggedItem = documentStore.getById(draggedItemId) || categoriesStore.getById(draggedItemId) || navigationItems.find(item => item.id === draggedItemId)?.data;
if (!draggedItem) return;
@@ -73,11 +80,11 @@ const drop = async (event: DragEvent) => {
if (draggedItem.id === props.item.id) return; // Prevent moving to the same document
documentStore.update({ ...draggedItem, parent_id: props.item.id, category: props.item.data.category });
}
- if (draggedItem.type === 'category' && props.item.data.type === 'default') {
+ if (draggedItem.type === 'category' && props.item.data.type === 'navigation') {
// Move category to root
categoriesStore.update({ ...draggedItem, parent_id: undefined, workspace_id: useSidebar().workspaceId.value || undefined });
}
- if (draggedItem.type === 'document' && props.item.data.type === 'default') {
+ if (draggedItem.type === 'document' && props.item.data.type === 'navigation') {
// Move document to root
documentStore.update({ ...draggedItem, parent_id: undefined, category: useSidebar().workspaceId.value || undefined });
}
@@ -89,7 +96,7 @@ const drop = async (event: DragEvent) => {
display: flex;
justify-content: flex-start;
align-items: center;
- padding: 1px 8px;
+ padding: 1px 4px;
margin: 2.5px 0;
border-radius: 6px;
color: var(--font-color);
diff --git a/frontend/components/Sidebar/helpers.ts b/frontend/components/Sidebar/helpers.ts
index 3104e113..625ad1ee 100644
--- a/frontend/components/Sidebar/helpers.ts
+++ b/frontend/components/Sidebar/helpers.ts
@@ -1,6 +1,6 @@
export interface DefaultItem {
id: string;
- type: 'default';
+ type: 'navigation';
label: string;
icon?: string;
route: string;
@@ -11,30 +11,53 @@ export interface Workspace {
value: string | null;
}
-export const navigationItems: DefaultItem[] = [
+export const navigationItems: Item<DefaultItem>[] = [
{
id: 'manage-categories',
- type: 'default',
+ parent_id: '',
label: 'Manage categories',
- icon: 'categories',
route: '/dashboard/categories',
- childrens: [],
+ icon: 'categories',
+ data: {
+ id: 'manage-categories',
+ type: 'navigation',
+ label: 'Manage categories',
+ icon: 'categories',
+ route: '/dashboard/categories',
+ childrens: [],
+ },
+ show: ref(true),
},
{
id: 'cdn',
- type: 'default',
+ parent_id: '',
label: 'CDN',
- icon: 'cdn',
route: '/dashboard/cdn',
- childrens: [],
+ icon: 'cdn',
+ data: {
+ id: 'cdn',
+ type: 'navigation',
+ label: 'CDN',
+ icon: 'cdn',
+ route: '/dashboard/cdn',
+ childrens: [],
+ },
+ show: ref(true),
},
-
{
id: 'settings',
- type: 'default',
+ parent_id: '',
label: 'Settings',
- icon: 'user_settings',
route: '/dashboard/settings',
- childrens: [],
+ icon: 'user_settings',
+ data: {
+ id: 'settings',
+ type: 'navigation',
+ label: 'Settings',
+ icon: 'user_settings',
+ route: '/dashboard/settings',
+ childrens: [],
+ },
+ show: ref(true),
},
];
diff --git a/frontend/composables/utils.ts b/frontend/composables/utils.ts
index ed747a04..1e856592 100644
--- a/frontend/composables/utils.ts
+++ b/frontend/composables/utils.ts
@@ -8,8 +8,8 @@ export const isMobile = () => (import.meta.client ? window.innerWidth <= 768 : f
// Intermediate screen size
export const isTablet = () => (import.meta.client ? window.innerWidth <= 1280 : false);
-export function useAvatar(user: User): string {
- return user.avatar ? CDN + '/' + user.id + '/avatar' : CDN + '/default_avatar.png';
+export function useAvatar(user?: User): string {
+ return user?.avatar ? CDN + '/' + user.id + '/avatar' : CDN + '/default_avatar.png';
}
export const AppColors = ['', 'blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];
@@ -38,6 +38,7 @@ export function debounce(fn: Function, wait: number) {
export function setAppColor(color: string | number) {
if (typeof color === 'number') {
+ if (color == 0) return;
color = getAppColor(color);
}
document.documentElement.style.setProperty('--primary', `var(--${color})`);
diff --git a/frontend/helpers/icons.ts b/frontend/helpers/icons.ts
index 29176645..d4522875 100644
--- a/frontend/helpers/icons.ts
+++ b/frontend/helpers/icons.ts
@@ -4,9 +4,9 @@ const icons = {
archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/><rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/></svg>`,
arrow_close: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-240 200-480l240-240 56 56-183 184 183 184-56 56Zm264 0L464-480l240-240 56 56-183 184 183 184-56 56Z"/></svg>`,
backup: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M260-160q-91 0-155.5-63T40-377q0-78 47-139t123-78q17-72 85-137t145-65q33 0 56.5 23.5T520-716v242l64-62 56 56-160 160-160-160 56-56 64 62v-242q-76 14-118 73.5T280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-48-22-89.5T600-680v-93q74 35 117 103.5T760-520q69 8 114.5 59.5T920-340q0 75-52.5 127.5T740-160H260Zm220-358Z"/></svg>`,
- categories: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M320-320h480v-480h-80v245q0 12-10 18t-20-1l-49-29q-10-6-21.5-6t-20.5 6l-49 29q-11 7-20.5 1t-9.5-18v-245H320v480Zm0 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-520q0-17 11.5-28.5T120-720q17 0 28.5 11.5T160-680v520h520q17 0 28.5 11.5T720-120q0 17-11.5 28.5T680-80H160Zm160-720v480-480Zm200 245q0 12 9.5 18t20.5-1l49-29q9-6 20.5-6t21.5 6l49 29q10 7 20 1t10-18q0 12-10 18t-20-1l-49-29q-10-6-21.5-6t-20.5 6l-49 29q-11 7-20.5 1t-9.5-18Z"/></svg>`,
+ categories: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-320h480v-480h-80v245q0 12-10 18t-20-1l-49-29q-10-6-21.5-6t-20.5 6l-49 29q-11 7-20.5 1t-9.5-18v-245H320v480Zm0 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-520q0-17 11.5-28.5T120-720q17 0 28.5 11.5T160-680v520h520q17 0 28.5 11.5T720-120q0 17-11.5 28.5T680-80H160Zm160-720v480-480Zm200 245q0 12 9.5 18t20.5-1l49-29q9-6 20.5-6t21.5 6l49 29q10 7 20 1t10-18q0 12-10 18t-20-1l-49-29q-10-6-21.5-6t-20.5 6l-49 29q-11 7-20.5 1t-9.5-18Z"/></svg>`,
//`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-320h480v-480h-80v280l-100-60-100 60v-280H320v480Zm0 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-560h80v560h560v80H160Zm360-720h200-200Zm-200 0h480-480Z"/></svg>`,
- cdn: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M485-440h163q26 0 44-18t18-44q0-26-18-44.5T648-565h-2q-5-32-29-53.5T560-640q-26 0-47 13.5T481-590q-30 2-50.5 23.5T410-515q0 30 21.5 52.5T485-440ZM120-120q-33 0-56.5-23.5T40-200v-480q0-17 11.5-28.5T80-720q17 0 28.5 11.5T120-680v480h640q17 0 28.5 11.5T800-160q0 17-11.5 28.5T760-120H120Zm160-160q-33 0-56.5-23.5T200-360v-440q0-33 23.5-56.5T280-880h167q16 0 30.5 6t25.5 17l57 57h280q33 0 56.5 23.5T920-720v360q0 33-23.5 56.5T840-280H280Zm0-80h560v-360H527l-80-80H280v440Zm0 0v-440 440Z"/></svg>`,
+ cdn: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M485-440h163q26 0 44-18t18-44q0-26-18-44.5T648-565h-2q-5-32-29-53.5T560-640q-26 0-47 13.5T481-590q-30 2-50.5 23.5T410-515q0 30 21.5 52.5T485-440ZM120-120q-33 0-56.5-23.5T40-200v-480q0-17 11.5-28.5T80-720q17 0 28.5 11.5T120-680v480h640q17 0 28.5 11.5T800-160q0 17-11.5 28.5T760-120H120Zm160-160q-33 0-56.5-23.5T200-360v-440q0-33 23.5-56.5T280-880h167q16 0 30.5 6t25.5 17l57 57h280q33 0 56.5 23.5T920-720v360q0 33-23.5 56.5T840-280H280Zm0-80h560v-360H527l-80-80H280v440Zm0 0v-440 440Z"/></svg>`,
close: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>`,
collapse: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m480-500 160-160H320l160 160Zm280-340q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560ZM200-320v120h560v-120H200Zm560-80v-360H200v360h560Zm-560 80v120-120Z"/></svg>`,
copy: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg>`,
@@ -15,13 +15,17 @@ const icons = {
dock: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-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-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z"/></svg>`,
draft: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--teal)" 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>`,
edit: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><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>`,
+ edit_page: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><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"/></svg>`,
file: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--red);" d="M200-200h360v-200h200v-360H200v560Zm0 80q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v400L600-120H200Zm80-280v-80h200v80H280Zm0-160v-80h400v80H280Zm-80 360v-560 560Z"/></svg>`,
- files: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M360-600v440h280v-120q0-17 11.5-28.5T680-320h120v-280H360Zm220 220ZM280-160v-441q0-33 24-56t57-23h439q33 0 56.5 23.5T880-600v287q0 16-6 30.5T857-257L703-103q-11 11-25.5 17T647-80H360q-33 0-56.5-23.5T280-160ZM81-710q-6-33 13-59.5t52-32.5l434-77q32-6 58 13.5t34 51.5l7 31q5 20-6 32t-26 14q-15 2-28.5-5.5T600-770l-7-30-433 77 60 344q3 17-6 30.5T188-332q-17 3-30-6.5T142-365L81-710Z"/></svg>`,
+ file_shortcut: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--primary)"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>`,
+ file_open: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v167q0 17-11.5 28.5T760-400q-17 0-28.5-11.5T720-440v-160H560q-17 0-28.5-11.5T520-640v-160H240v640h320q17 0 28.5 11.5T600-120q0 17-11.5 28.5T560-80H240Zm520-103v49q0 17-11.5 28.5T720-94q-17 0-28.5-11.5T680-134v-146q0-17 11.5-28.5T720-320h146q17 0 28.5 11.5T906-280q0 17-11.5 28.5T866-240h-50l90 90q11 11 11 27.5T906-94q-12 12-28.5 12T849-94l-89-89Zm-520 23v-640 640Z"/></svg>`,
+ files: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M360-600v440h280v-120q0-17 11.5-28.5T680-320h120v-280H360Zm220 220ZM280-160v-441q0-33 24-56t57-23h439q33 0 56.5 23.5T880-600v287q0 16-6 30.5T857-257L703-103q-11 11-25.5 17T647-80H360q-33 0-56.5-23.5T280-160ZM81-710q-6-33 13-59.5t52-32.5l434-77q32-6 58 13.5t34 51.5l7 31q5 20-6 32t-26 14q-15 2-28.5-5.5T600-770l-7-30-433 77 60 344q3 17-6 30.5T188-332q-17 3-30-6.5T142-365L81-710Z"/></svg>`,
file_parent: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><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>`,
folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" style="fill:var(--yellow)"><path style="fill:var(--yellow)" 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>`,
- folder_s: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" ><path d="M160-160q-33 0-56.5-23.5T80-240v-400q0-33 23.5-56.5T160-720h240l80-80h320q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm73-280h207v-207L233-440Zm-73-40 160-160H160v160Zm0 120v120h640v-480H520v280q0 33-23.5 56.5T440-360H160Zm280-160Z"/></svg>`,
+ folder_s: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-160q-33 0-56.5-23.5T80-240v-400q0-33 23.5-56.5T160-720h240l80-80h320q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm73-280h207v-207L233-440Zm-73-40 160-160H160v160Zm0 120v120h640v-480H520v280q0 33-23.5 56.5T440-360H160Zm280-160Z"/></svg>`,
image: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M200-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-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>`,
- import: `<svg xmlns="http://www.w3.org/2000/svg"viewBox="0 -960 960 960" ><path d="M480-800 243-663l237 137 237-137-237-137ZM120-321v-318q0-22 10.5-40t29.5-29l280-161q10-5 19.5-8t20.5-3q11 0 21 3t19 8l280 161q19 11 29.5 29t10.5 40v119q0 17-11.5 28.5T800-480q-17 0-28.5-11.5T760-520v-76L519-457q-19 11-40 11t-40-11L200-596v274l220 128q9 5 14.5 14t5.5 20q0 23-20 34.5t-40 .5L160-252q-19-11-29.5-29T120-321ZM720 0q-83 0-141.5-58.5T520-200q0-83 58.5-141.5T720-400q83 0 141.5 58.5T920-200q0 83-58.5 141.5T720 0ZM480-491Zm220 335-58-58q-6-6-14-6t-14 6q-6 6-6 14t6 14l78 78q6 6 13 8.5t15 2.5q8 0 15-2.5t13-8.5l78-78q6-6 6-14t-6-14q-6-6-14-6t-14 6l-58 58v-144q0-8-6-14t-14-6q-8 0-14 6t-6 14v144Z"/></svg>`,
+ import: `<svg xmlns="http://www.w3.org/2000/svg"viewBox="0 -960 960 960"><path d="M480-800 243-663l237 137 237-137-237-137ZM120-321v-318q0-22 10.5-40t29.5-29l280-161q10-5 19.5-8t20.5-3q11 0 21 3t19 8l280 161q19 11 29.5 29t10.5 40v119q0 17-11.5 28.5T800-480q-17 0-28.5-11.5T760-520v-76L519-457q-19 11-40 11t-40-11L200-596v274l220 128q9 5 14.5 14t5.5 20q0 23-20 34.5t-40 .5L160-252q-19-11-29.5-29T120-321ZM720 0q-83 0-141.5-58.5T520-200q0-83 58.5-141.5T720-400q83 0 141.5 58.5T920-200q0 83-58.5 141.5T720 0ZM480-491Zm220 335-58-58q-6-6-14-6t-14 6q-6 6-6 14t6 14l78 78q6 6 13 8.5t15 2.5q8 0 15-2.5t13-8.5l78-78q6-6 6-14t-6-14q-6-6-14-6t-14 6l-58 58v-144q0-8-6-14t-14-6q-8 0-14 6t-6 14v144Z"/></svg>`,
+ link: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h120q17 0 28.5 11.5T440-640q0 17-11.5 28.5T400-600H280q-50 0-85 35t-35 85q0 50 35 85t85 35h120q17 0 28.5 11.5T440-320q0 17-11.5 28.5T400-280H280Zm80-160q-17 0-28.5-11.5T320-480q0-17 11.5-28.5T360-520h240q17 0 28.5 11.5T640-480q0 17-11.5 28.5T600-440H360Zm200 160q-17 0-28.5-11.5T520-320q0-17 11.5-28.5T560-360h120q50 0 85-35t35-85q0-50-35-85t-85-35H560q-17 0-28.5-11.5T520-640q0-17 11.5-28.5T560-680h120q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H560Z"/></svg>`,
list: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-280q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360h480q17 0 28.5 11.5T680-320q0 17-11.5 28.5T640-280H160Zm80-160q-17 0-28.5-11.5T200-480q0-17 11.5-28.5T240-520h480q17 0 28.5 11.5T760-480q0 17-11.5 28.5T720-440H240Zm80-160q-17 0-28.5-11.5T280-640q0-17 11.5-28.5T320-680h480q17 0 28.5 11.5T840-640q0 17-11.5 28.5T800-600H320Z"/></svg>`,
logout: `<svg xmlns="http://www.w3.org/2000/svg" style="fill:var(--font-color);" viewBox="0 -960 960 960"><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>`,
markdown: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><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>`,
diff --git a/frontend/pages/dashboard/cdn/[id]/preview.vue b/frontend/pages/dashboard/cdn/[id]/preview.vue
index f0895344..986c6829 100644
--- a/frontend/pages/dashboard/cdn/[id]/preview.vue
+++ b/frontend/pages/dashboard/cdn/[id]/preview.vue
@@ -2,7 +2,7 @@
<div class="card-component">
<div v-if="ressource">
<header style="display: flex; justify-content: space-between; align-items: center">
- <h2>Preview <tag blue>New</tag></h2>
+ <h1>Preview <tag blue>New</tag></h1>
<div style="display: flex">
<NuxtLink :to="`/dashboard/cdn/${ressource.id}`"><AppButton type="primary">Edit</AppButton></NuxtLink>
<AppButton type="secondary" @click="copyLink">Copy link</AppButton>
diff --git a/frontend/pages/dashboard/docs/[id].vue b/frontend/pages/dashboard/docs/[id].vue
index 64fad8a7..03e7211c 100644
--- a/frontend/pages/dashboard/docs/[id].vue
+++ b/frontend/pages/dashboard/docs/[id].vue
@@ -6,7 +6,7 @@
<article class="document-theme" style="max-width: 100%" ref="element" v-html="article.content_html"></article>
<DocumentCardFooter :document="article" :next="next" :previous="previous" />
</div>
- <div v-if="!isTablet() && !preferencesStore.get('hideTOC')"><TableOfContent :tags="article.tags" :element="element" :doc_id="article.id" class="toc" style="width: 400px" /></div>
+ <div v-if="!isTablet() && !preferencesStore.get('hideTOC')" class="toc"><TableOfContent :doc="article" :element="element" class="toc" style="width: 400px" /></div>
<div :style="{ marginRight: !isTablet() && preferencesStore.get('hideTOC') && useSidebar().isOpened.value ? '370px' : '0px', transition: 'margin 0.3s' }"></div>
</div>
</div>
@@ -37,8 +37,8 @@ watchEffect(async () => {
try {
error.value = false;
article.value = await documentsStore.fetch({ id: document_id });
- } catch (err) {
- error.value = err instanceof Error ? err.message : (err as string);
+ } catch (err: any) {
+ error.value = err.message || 'Failed to fetch document';
}
} else article.value = docFromStore;
useHead({ title: `Alexandrie ${article.value?.name || ''}` });
@@ -54,3 +54,11 @@ definePageMeta({
const next = computed(() => documentsStore.getNext(article.value));
const previous = computed(() => documentsStore.getPrevious(article.value));
</script>
+
+<style scoped lang="scss">
+@media screen and (max-width: 1280px) {
+ .toc {
+ display: none;
+ }
+}
+</style>
diff --git a/frontend/pages/dashboard/docs/_components/DocumentCardFooter.vue b/frontend/pages/dashboard/docs/_components/DocumentCardFooter.vue
index f0a5537e..4d54159d 100644
--- a/frontend/pages/dashboard/docs/_components/DocumentCardFooter.vue
+++ b/frontend/pages/dashboard/docs/_components/DocumentCardFooter.vue
@@ -1,14 +1,7 @@
<template>
<footer>
<div class="infos">
- <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"
- />
- </svg>
- Edit this page</NuxtLink
- >
+ <NuxtLink :to="`/dashboard/docs/edit/${document.id}`"><Icon name="edit_page" /> Edit this page</NuxtLink>
<p>Last update: {{ new Date(parseInt(document.updated_timestamp)).toLocaleDateString() }}</p>
</div>
<div class="items">
@@ -33,18 +26,18 @@ defineProps<{ document: Document; next?: Document; previous?: Document }>();
footer {
margin: 50px 0 40px 0;
}
-
-@media screen and (min-width: 768px) {
- .items {
- display: flex;
- justify-content: space-between;
- }
+.items {
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ gap: 10px;
}
.item {
display: block;
width: 100%;
max-width: 400px;
+ min-width: 280px;
border-radius: 7px;
border: 1px solid var(--border-color);
padding: 10px;
@@ -52,13 +45,14 @@ footer {
font-weight: 500;
font-size: 15px;
transition: color 0.25s;
-
+ flex: 1;
b {
display: block;
}
&:hover {
border: 1px solid var(--primary);
+ color: var(--primary);
}
}
diff --git a/frontend/pages/dashboard/docs/_components/table-of-content/TableOfContents.vue b/frontend/pages/dashboard/docs/_components/table-of-content/TableOfContents.vue
index fec9bcfe..b898f2d6 100644
--- a/frontend/pages/dashboard/docs/_components/table-of-content/TableOfContents.vue
+++ b/frontend/pages/dashboard/docs/_components/table-of-content/TableOfContents.vue
@@ -1,22 +1,25 @@
<template>
<aside>
- <h4 v-if="tags">Tags</h4>
+ <h4 v-if="doc?.tags">Tags</h4>
<div style="display: flex; flex-wrap: wrap; font-size: 14px">
- <tag v-if="tags" v-for="tag in tags.split(',')" :key="tag" class="primary">#{{ tag.trim() }}</tag>
+ <tag v-if="doc?.tags" v-for="tag in doc?.tags.split(',')" :key="tag" class="primary">#{{ tag.trim() }}</tag>
</div>
<ul ref="list" style="position: relative">
<div class="marker" ref="marker"></div>
<h4>Table of contents</h4>
- <NodeTree v-if="headers.length" v-for="header of headers_tree" :node="header" :key="header.link" />
+ <NodeTree v-if="headers.length" v-for="header of headers_tree" :node="header" :key="header.link" style="padding-left: 10px" />
<p v-else>Nothing to display</p>
</ul>
+ <h4 v-if="childs.length">Child documents</h4>
+ <NuxtLink v-for="child in childs" :key="child.id" :to="`/dashboard/docs/${child.id}`" class="child-link"><Icon name="file_shortcut" />{{ child.data.name as string }}</NuxtLink>
</aside>
</template>
<script lang="ts" setup>
+import type { Document } from '~/stores';
import NodeTree from './NodeTree.vue';
-const props = defineProps<{ element?: HTMLElement; tags?: string }>();
+const props = defineProps<{ element?: HTMLElement; doc?: Document }>();
const list = ref<HTMLElement>();
interface GroupedHeaders {
@@ -58,11 +61,9 @@ function buildTree(tree: GroupedHeaders[]): TreeItem[] {
}
if (stack.length > 0) {
if (!stack[stack.length - 1]!.childrens) stack[stack.length - 1]!.childrens = [];
- // @ts-ignore
- stack[stack.length - 1].childrens.push(item);
- } else {
- result.push(item);
- }
+ else stack[stack.length - 1]!.childrens!.push(item);
+ } else result.push(item);
+
stack.push(item);
}
return result;
@@ -99,6 +100,13 @@ function handleScroll() {
}
onMounted(() => window.addEventListener('scroll', handleScroll));
onBeforeUnmount(() => window.removeEventListener('scroll', handleScroll));
+
+const childs = computed(
+ () =>
+ useSidebarTree()
+ .structure.value.childrenMap.get(props.doc?.id || '')
+ ?.filter(c => c.data.type === 'document') || [],
+) as Ref<Item<Document>[]>;
</script>
<style lang="scss" scoped>
@@ -110,8 +118,8 @@ aside {
max-width: 350px;
position: sticky;
top: 20px;
- left: 10px;
- font-size: 0.75rem;
+ margin-left: 50px;
+ font-size: 0.8rem;
border-left: 1px solid var(--border-color);
padding-left: 10px;
}
@@ -134,4 +142,19 @@ li:deep(a).active {
color: var(--primary);
font-weight: 600;
}
+
+.child-link {
+ display: flex;
+ align-items: flex-start;
+ margin: 5px 0;
+ font-weight: bold;
+ gap: 5px;
+ color: var(--font-color);
+ text-decoration: none;
+ transition: color 0.25s;
+
+ &:hover {
+ color: var(--primary);
+ }
+}
</style>
diff --git a/frontend/pages/dashboard/docs/index.vue b/frontend/pages/dashboard/docs/index.vue
index d3ff2663..7683184e 100644
--- a/frontend/pages/dashboard/docs/index.vue
+++ b/frontend/pages/dashboard/docs/index.vue
@@ -4,12 +4,9 @@
<h1>Documents <tag blue>New</tag></h1>
<ViewSelection v-model="view" />
</header>
- <DataTable :headers="headers" :rows="rows" v-if="view === 'table'">
- <template #actions="{ cell }">
- <NuxtLink :to="`/dashboard/docs/${cell?.data.id}`"><Icon name="view" /></NuxtLink>
- <NuxtLink :to="`/dashboard/docs/edit/${cell?.data.id}`"><Icon name="edit" /></NuxtLink>
- </template>
- </DataTable>
+ <div v-if="view == 'table'" class="line-container">
+ <DocumentLine v-for="document of documents" :document="document" class="line-item" :key="document.id" />
+ </div>
<div v-else class="document-list">
<DocumentsGrid :documents="documents" />
</div>
@@ -65,4 +62,18 @@ function stringToBadge(str?: string): string {
}
</script>
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+// Line container first item radius:
+.line-container {
+ display: flex;
+ flex-direction: column;
+}
+.line-item:first-child {
+ border-top-left-radius: 12px;
+ border-top-right-radius: 12px;
+}
+.line-item:last-child {
+ border-bottom-left-radius: 12px;
+ border-bottom-right-radius: 12px;
+}
+</style>
diff --git a/frontend/pages/dashboard/home.vue b/frontend/pages/dashboard/home.vue
index 54995bb2..53f9d91e 100644
--- a/frontend/pages/dashboard/home.vue
+++ b/frontend/pages/dashboard/home.vue
@@ -1,17 +1,97 @@
<template>
- <div style="text-align: center; margin: 10vh auto; gap: 20px">
+ <div style="text-align: center; margin: 5vh auto; gap: 20px">
<h1>Alexandrie dashboard</h1>
<img style="max-width: 300px; max-height: 300px" :src="`/empty-${colorMode.value}.png`" /> <br />
- <NuxtLink to="/dashboard/docs/new"><AppButton type="link">+ Create new document </AppButton></NuxtLink>
+ <div class="search-container">
+ <input type="text" v-model="searchQuery" placeholder="Search documents..." class="search-input" />
+ <div v-if="results.length" class="results">
+ <NuxtLink v-for="result in results" :key="result.id" class="result" :to="`/dashboard/docs/${result.id}`">{{ result.name }}</NuxtLink>
+ </div>
+ </div>
+ <div style="text-align: left; width: 90%; margin: 0 auto">
+ <div class="recent">
+ <DocumentCard v-for="doc in recentDocuments" :key="doc.id" :document="doc" />
+ </div>
+ <NuxtLink to="/dashboard/docs/new" class="add-doc">+</NuxtLink>
+ </div>
</div>
</template>
<script setup lang="ts">
const colorMode = useColorMode();
+const searchQuery = ref('');
+
+const documentsStore = useDocumentsStore();
+const results = computed(() => {
+ if (!searchQuery.value) return [];
+ return documentsStore.getAll.filter(doc => doc.name.toLowerCase().includes(searchQuery.value.toLowerCase())).slice(0, 5);
+});
+const recentDocuments = computed(() => {
+ return documentsStore.getAll
+ .sort((a, b) => {
+ return parseInt(b.updated_timestamp) - parseInt(a.updated_timestamp);
+ })
+ .slice(0, 3);
+});
</script>
-<style scoped>
+<style scoped lang="scss">
h1 {
font-size: 32px;
margin-bottom: 20px;
}
+.add-doc {
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ width: 50px;
+ height: 50px;
+ background-color: var(--primary);
+ color: white;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 30px;
+ text-decoration: none;
+}
+.search-container {
+ position: relative;
+ margin: 20px auto;
+ width: 500px;
+}
+.search-input {
+ width: 500px;
+ padding: 10px;
+ border-radius: 5px;
+ border: 1px solid var(--border-color);
+ margin: 0 auto;
+}
+.results {
+ position: absolute;
+ background-color: var(--bg-color);
+ border: 1px solid var(--border-color);
+ border-radius: 8px;
+ padding: 10px;
+ width: 500px;
+ text-align: left;
+ max-height: 300px;
+ overflow-y: auto;
+ z-index: 10;
+}
+.result {
+ display: block;
+ padding: 5px;
+ cursor: pointer;
+ transition: background-color 0.2s;
+ &:hover {
+ background-color: var(--bg-contrast);
+ }
+}
+.recent {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: 20px;
+ margin-top: 20px;
+}
</style>
diff --git a/frontend/pages/dashboard/settings/index.vue b/frontend/pages/dashboard/settings/index.vue
index 658c91ee..5d38b390 100644
--- a/frontend/pages/dashboard/settings/index.vue
+++ b/frontend/pages/dashboard/settings/index.vue
@@ -57,11 +57,10 @@ const currentPage = ref(route.query.p || 'profile');
const store = useUserStore();
const router = useRouter();
+const routeBeforeEnter = ref();
+onBeforeMount(() => (routeBeforeEnter.value = useRouter().options.history.state.back));
watchEffect(() => (currentPage.value = route.query.p || 'profile'));
-
-const close = () => router.push('/dashboard');
-
-watchEffect(() => (currentPage.value = route.query.p || 'profile'));
+const close = () => router.push(routeBeforeEnter.value || '/dashboard');
</script>
<style scoped lang="scss">
diff --git a/frontend/styles/_variables.scss b/frontend/styles/_variables.scss
index 9c4384c1..ac9bc611 100644
--- a/frontend/styles/_variables.scss
+++ b/frontend/styles/_variables.scss
@@ -36,21 +36,21 @@ $primary-dark: color.adjust(#6024ec, $lightness: -10%);
- --primary: #6024ec;
- --primary-bg: rgba(111, 66, 193, 0.2);
- --primary-border: rgba(111, 66, 193, 0.25);
-
- --bg-color: #fff;
- --bg-contrast: #f2f7fc;
+ --primary: #3956e7;
+ --primary-bg: #dde1f8;
+ --primary-border: #dde1f8;
+ --bg-soft: #fafafa;
+ --bg-color: #fcfcfc;
+ --bg-contrast: #f3f3f5;
--bg-contrast-2: #e2ebfd;
--selection-color: #dde3e9;
--font-color: #3c4450;
- --font-color-dark: #374151;
- --font-color-light: #5a6170;
+ --font-color-dark: #211d34;
+ --font-color-light: #5b5967;
--opposite-color: #111;
- --border-color: #e0e2ec;
+ --border-color: #dfe0e5;
--border-color-accent: #c4c6d0;
- --shadow: rgba(0, 0, 0, 0.2);
+ --shadow: rgba(0, 0, 0, 0.15);
// COLORS \\
@@ -82,6 +82,11 @@ $primary-dark: color.adjust(#6024ec, $lightness: -10%);
}
.dark-mode {
+
+ --primary: #3956e7;
+ --primary-bg: #8e5fff1f;
+ --primary-border: #8e5fff1f;
+
--bg-color: #1c2127;
--bg-contrast: #2a2f35;
--bg-contrast-2: #363a42;
@@ -127,32 +132,35 @@ $primary-dark: color.adjust(#6024ec, $lightness: -10%);
}
-@mixin print-theme {
+@media print {
+
// THEME \\
- --bg-color: #fff;
- --bg-contrast: #F1F6FD;
- --bg-contrast-2: #ECF2FF;
- --selection-color: #e1f2ff;
- --font-color: #1f2937;
- --font-color-dark: #374151;
- --font-color-light: #6b7280;
- --border-color: rgba(0, 0, 0, 0.1);
- // COLORS \\
- --grey: #666;
- --grey-bg: rgb(240, 240, 240);
- --blue: #007aff;
- --blue-bg: #cce0ff;
- --blue-border: rgba(0, 123, 255, 0.3);
- --green: #009879;
- --green-bg: rgba(40, 167, 69, 0.15);
- --green-border: rgba(40, 167, 69, 0.3);
- --red: #FF204E;
- --red-bg: rgba(220, 53, 69, 0.15);
- --red-border: rgba(220, 53, 69, 0.3);
- --yellow: #F97300;
- --yellow-bg: rgba(255, 193, 7, 0.15);
- --yellow-border: rgba(255, 193, 7, 0.3);
- --teal: #00ADB5;
- --teal-bg: rgba(23, 162, 184, 0.2);
- --teal-border: rgba(23, 162, 184, 0.25);
+ :root {
+ --bg-color: #fff;
+ --bg-contrast: #F1F6FD;
+ --bg-contrast-2: #ECF2FF;
+ --selection-color: #e1f2ff;
+ --font-color: #1f2937;
+ --font-color-dark: #374151;
+ --font-color-light: #6b7280;
+ --border-color: rgba(0, 0, 0, 0.1);
+ // COLORS \\
+ --grey: #666;
+ --grey-bg: rgb(240, 240, 240);
+ --blue: #007aff;
+ --blue-bg: #cce0ff;
+ --blue-border: rgba(0, 123, 255, 0.3);
+ --green: #009879;
+ --green-bg: rgba(40, 167, 69, 0.15);
+ --green-border: rgba(40, 167, 69, 0.3);
+ --red: #FF204E;
+ --red-bg: rgba(220, 53, 69, 0.15);
+ --red-border: rgba(220, 53, 69, 0.3);
+ --yellow: #F97300;
+ --yellow-bg: rgba(255, 193, 7, 0.15);
+ --yellow-border: rgba(255, 193, 7, 0.3);
+ --teal: #00ADB5;
+ --teal-bg: rgba(23, 162, 184, 0.2);
+ --teal-border: rgba(23, 162, 184, 0.25);
+ }
}
\ No newline at end of file
diff --git a/frontend/styles/components.scss b/frontend/styles/components.scss
index b2cb2c60..b3a09eed 100644
--- a/frontend/styles/components.scss
+++ b/frontend/styles/components.scss
@@ -15,8 +15,8 @@
gap: 16px;
padding: 24px;
border-radius: 8px;
- box-shadow: 0 2px 10px var(--shadow);
-
+ box-shadow: 0 2px 6px var(--shadow);
+ border: 1px solid var(--border-color);
header {
@@ -36,7 +36,7 @@
tag {
padding: 2px 4px;
border-radius: 6px;
- margin: 1px 2px;
+ margin: 1px 2px 1px 0;
font-size: 0.8em;
}
diff --git a/frontend/styles/main.scss b/frontend/styles/main.scss
index 49eb3b12..0c5aef21 100644
--- a/frontend/styles/main.scss
+++ b/frontend/styles/main.scss
@@ -16,7 +16,8 @@
::-webkit-scrollbar {
width: 2px;
- background: var(--bg-contrast);
+ height: 98%;
+ background: transparent;
}
::-webkit-scrollbar-thumb {
@@ -90,9 +91,6 @@ form {
}
@media print {
- :root {
- @include print-theme;
- }
header,
footer,