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.

Fixes and styles improvments

Smaug673970b96e15cace
diff --git a/frontend/composables/icons.ts b/frontend/composables/icons.ts
index 0127f4c4..4cb587a4 100644
--- a/frontend/composables/icons.ts
+++ b/frontend/composables/icons.ts
@@ -16,6 +16,10 @@ const icons = {
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>`,
archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><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>`,
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>`,
+ view: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><path d="M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"/></svg>`,
+ delete: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--font-color)"><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>`,
+ 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>`,
+ 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>`,
};
export type IconName = keyof typeof icons;
diff --git a/frontend/pages/dashboard/admin/users/[id].vue b/frontend/pages/dashboard/admin/users/[id].vue
index cd049687..fbf12a66 100644
--- a/frontend/pages/dashboard/admin/users/[id].vue
+++ b/frontend/pages/dashboard/admin/users/[id].vue
@@ -1,7 +1,7 @@
<template>
- <div class="component">
+ <div class="card-component">
<h2>User Details</h2>
- <div v-if="user">
+ <div v-if="user" style="width: 100%">
<div class="user-details">
<div class="user-detail">
<label for="username">Username</label>
@@ -60,10 +60,10 @@ const saveChanges = async () => {
useUserStore()
.update(user.value)
.then(() => {
- useNotifications().add({ type: 'success', title: 'Success', message: 'User updated successfully', timeout: 5000 });
+ useNotifications().add({ type: 'success', title: 'Success', message: 'User updated successfully', timeout: 3000 });
})
.catch(e => {
- useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 5000 });
+ useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 3000 });
});
};
@@ -71,14 +71,6 @@ definePageMeta({ breadcrumb: 'User Details' });
</script>
<style scoped lang="scss">
-.component {
- gap: 1.5rem;
- padding: 2rem;
- border-radius: 8px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
- width: 100%;
-}
-
.user-details {
display: flex;
flex-direction: column;
diff --git a/frontend/pages/dashboard/admin/users/index.vue b/frontend/pages/dashboard/admin/users/index.vue
index d3014d8b..8b9be02b 100644
--- a/frontend/pages/dashboard/admin/users/index.vue
+++ b/frontend/pages/dashboard/admin/users/index.vue
@@ -1,10 +1,11 @@
<template>
- <div class="cdn-component">
- <h2>Users manager</h2>
-
- <div v-if="userStore.users.length">
- <DataTable :headers="headers" :rows="rows" />
- </div>
+ <div class="card-component">
+ <h2 style="margin: 0">Users manager</h2>
+ <DataTable v-if="userStore.users.length" :headers="headers" :rows="rows">
+ <template #action="{ cell }">
+ <NuxtLink :to="`/dashboard/admin/users/${cell?.data.id}`"><Icon name="view" /></NuxtLink>
+ </template>
+ </DataTable>
<div v-else>No user found.</div>
</div>
</template>
@@ -22,35 +23,20 @@ const headers = [
{ label: 'Created at', key: 'created_at' },
{ label: 'Action', key: 'action' },
];
-const seeIcon = ` <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" style="margin:0 5px;" fill="var(--font-color-light)"><path d="M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"/></svg>`;
-const rows: any = computed(() =>
- userStore.users.map(res => {
+const rows = computed(() =>
+ userStore.users.map(u => {
return {
- username: { content: `<img style="border-radius:50%;width:25px;height:25px;" src="${useAvatar(res)}"/>&nbsp;&nbsp;&nbsp;${res.username}`, type: 'html' },
- firstname: { content: res.firstname },
- lastname: { content: res.lastname },
- email: { content: res.email },
- role: { content: res.role == 2 ? `<span class="tag red">Admin</span>` : `<span class="tag blue">User</span>`, type: 'html' },
- created_at: { content: new Date(res.created_timestamp).toLocaleDateString() },
- action: { content: seeIcon, type: 'link', to: `/dashboard/admin/users/${res.id}` },
+ username: { content: `<img style="border-radius:50%;width:25px;height:25px;" src="${useAvatar(u)}"/>&nbsp;&nbsp;&nbsp;${u.username}`, type: 'html' as const },
+ firstname: { content: u.firstname, type: 'text' as const },
+ lastname: { content: u.lastname, type: 'text' as const },
+ email: { content: u.email, type: 'text' as const },
+ role: { content: u.role == 2 ? `<span class="tag red">Admin</span>` : `<span class="tag blue">User</span>`, type: 'html' as const },
+ created_at: { content: new Date(u.created_timestamp).toLocaleDateString(), type: 'text' as const },
+ action: { type: 'slot' as const, data: { id: u.id } },
};
}),
);
</script>
-<style scoped lang="scss">
-.cdn-component {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 1.5rem;
- padding: 2rem;
- border-radius: 8px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
-}
-
-h2 {
- margin: 0;
-}
-</style>
+<style scoped lang="scss"></style>
diff --git a/frontend/pages/dashboard/categories/edit.vue b/frontend/pages/dashboard/categories/edit.vue
index b2c512f4..b1a0360d 100644
--- a/frontend/pages/dashboard/categories/edit.vue
+++ b/frontend/pages/dashboard/categories/edit.vue
@@ -1,7 +1,7 @@
<template>
<div class="category-form-container">
<h2>Update category & workspace</h2>
- <form @submit.prevent="updateCategory">
+ <form @submit.prevent>
<label>ID</label>
<input type="text" v-model="category.id" id="id" disabled />
<label>Role</label>
@@ -27,7 +27,7 @@
<input type="number" v-model.number="category.order" id="order" />
<div style="display: flex; justify-content: flex-end">
<AppButton type="danger" @click="deleteCategory()">Delete</AppButton>
- <AppButton type="primary" class="btn primary">Update</AppButton>
+ <AppButton type="primary" class="btn primary" @click="updateCategory">Update</AppButton>
</div>
</form>
</div>
@@ -45,20 +45,20 @@ const updateCategory = async () => {
categoriesStore
.update(category.value)
.then(() => {
- useNotifications().add({ title: 'Success:', message: 'Category updated', type: 'success', timeout: 5000 });
+ useNotifications().add({ title: 'Success:', message: 'Category updated', type: 'success', timeout: 3000 });
useRouter().push('/dashboard/categories');
})
- .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 5000 }));
+ .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
};
const deleteCategory = async () => {
if (category.value)
categoriesStore
.delete(category.value.id)
.then(() => {
- useNotifications().add({ title: 'Success:', message: 'Category deleted', type: 'success', timeout: 5000 });
+ useNotifications().add({ title: 'Success:', message: 'Category deleted', type: 'success', timeout: 3000 });
useRouter().push('/dashboard/categories');
})
- .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 5000 }));
+ .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
};
</script>
diff --git a/frontend/pages/dashboard/categories/new.vue b/frontend/pages/dashboard/categories/new.vue
index 3e2c2c48..9a0a8b3c 100644
--- a/frontend/pages/dashboard/categories/new.vue
+++ b/frontend/pages/dashboard/categories/new.vue
@@ -39,10 +39,10 @@ function createCategory() {
categoriesStore
.post(category.value)
.then(() => {
- useNotifications().add({ title: 'Success:', message: 'Category posted', type: 'success', timeout: 5000 });
+ useNotifications().add({ title: 'Success:', message: 'Category posted', type: 'success', timeout: 3000 });
useRouter().push('/dashboard/categories');
})
- .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 5000 }));
+ .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
}
</script>
diff --git a/frontend/pages/dashboard/cdn.vue b/frontend/pages/dashboard/cdn.vue
index 9ce2cca0..07b59d35 100644
--- a/frontend/pages/dashboard/cdn.vue
+++ b/frontend/pages/dashboard/cdn.vue
@@ -1,6 +1,6 @@
<template>
- <div class="cdn-component">
- <h2>CDN: File manager</h2>
+ <div class="card-component">
+ <h2 style="margin: 0">CDN: File manager</h2>
<div class="dropzone" :class="{ 'drag-over': isDragOver }" @dragover.prevent @drop.prevent="handleFileDrop" @dragenter.prevent="dragEnter" @dragleave.prevent="dragLeave">
<input type="file" ref="fileInput" @change="handleFileSelect" />
<div v-if="selectedFile" class="file-info">
@@ -16,7 +16,12 @@
<AppButton @click="copyLink" type="primary">Copy link</AppButton>
</div>
<div v-if="ressourcesStore.ressources.length" class="ressources-list">
- <DataTable :headers="headers" :rows="rows" />
+ <DataTable :headers="headers" :rows="rows">
+ <template #action="{ cell }">
+ <a :href="`${CDN}${cell?.data.transformed_path || cell?.data.original_path}`" target="_blank"><Icon name="view" /> </a>
+ <Icon name="delete" @click="() => deleteRessource(cell?.data.id)" />
+ </template>
+ </DataTable>
</div>
<div v-else>No ressource found.</div>
</div>
@@ -58,7 +63,7 @@ const submitFile = async () => {
await ressourcesStore
.post(body)
.then(r => (fileLink.value = `${CDN}/${(r as DB_Ressource).transformed_path || (r as DB_Ressource).original_path}`))
- .catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 5000 }))
+ .catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 3000 }))
.finally(() => (isLoading.value = false));
};
@@ -82,27 +87,21 @@ const rows: any = computed(() =>
size: { content: readableFileSize(res.file_size) },
type: { content: `<span class="tag ${color(res.file_type)}">${res.file_type}</span>`, type: 'html' },
date: { content: new Date(res.created_timestamp).toLocaleDateString() },
- action: { content: `<a href="${CDN}/${res.transformed_path || res.original_path}" target="_blank">View</a>`, type: 'html' },
+ action: { type: 'slot', data: res },
};
}),
);
+
+const deleteRessource = async (id: string) => {
+ if (!id) return;
+ await ressourcesStore
+ .delete(id)
+ .then(() => useNotifications().add({ type: 'success', title: 'Success', message: 'Ressource deleted successfully', timeout: 3000 }))
+ .catch(e => useNotifications().add({ type: 'error', title: 'Error', message: e, timeout: 3000 }));
+};
</script>
<style scoped lang="scss">
-.cdn-component {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 1.5rem;
- padding: 2rem;
- border-radius: 8px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
-}
-
-h2 {
- margin: 0;
-}
-
.dropzone {
display: flex;
align-items: center;
@@ -170,6 +169,10 @@ h2 {
text-decoration: underline;
}
+.ressources-list {
+ width: 100%;
+}
+
@keyframes spin {
0% {
transform: rotate(0deg);
diff --git a/frontend/pages/dashboard/docs/edit/[id].vue b/frontend/pages/dashboard/docs/edit/[id].vue
index 40f20eb2..bf349d08 100644
--- a/frontend/pages/dashboard/docs/edit/[id].vue
+++ b/frontend/pages/dashboard/docs/edit/[id].vue
@@ -29,7 +29,7 @@ definePageMeta({ breadcrumb: 'Edit' });
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 }));
+ .then(() => notifications.add({ title: 'Success:', message: 'Document updated', type: 'success', timeout: 3000 }))
+ .catch(e => notifications.add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
}
</script>
diff --git a/frontend/pages/dashboard/docs/index.vue b/frontend/pages/dashboard/docs/index.vue
index d138e49f..acaf366a 100644
--- a/frontend/pages/dashboard/docs/index.vue
+++ b/frontend/pages/dashboard/docs/index.vue
@@ -1,6 +1,11 @@
<template>
<h2 style="text-align: center">Search documents</h2>
- <DataTable :headers="headers" :rows="rows" />
+ <DataTable :headers="headers" :rows="rows">
+ <template #actions="{ cell }">
+ <NuxtLink :to="`/dashboard/docs/${cell?.data.id}`" class="btn btn-primary"><Icon name="view" /></NuxtLink>
+ <NuxtLink :to="`/dashboard/docs/edit/${cell?.data.id}`" class="btn btn-primary"><Icon name="edit" /></NuxtLink>
+ </template>
+ </DataTable>
</template>
<script setup lang="ts">
@@ -14,7 +19,7 @@ const headers = [
{ label: 'Status', key: 'status' },
{ label: 'Actions', key: 'actions' },
];
-const rows: any = computed(() =>
+const rows = computed(() =>
documents.value.map(doc => {
let badges = '';
switch (doc.accessibility) {
@@ -29,25 +34,24 @@ const rows: any = computed(() =>
}
if (doc.parent_id) badges += '<span class="tag yellow">Child</span>';
if (documents.value.some(d => d.parent_id === doc.id)) badges += '<span class="tag yellow">Parent</span>';
- const seeIcon = ` <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" style="margin:0 5px;" fill="var(--font-color-light)"><path d="M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"/></svg>`;
- const editIcon = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" style="margin:0 5px;" fill="var(--font-color-light)"><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>`;
return {
- name: { content: doc.name, type: 'link', to: `/dashboard/docs/${doc.id}` },
- category: { content: categoriesStore.getById(doc.category || '')?.name || '' },
- tags: {
- content: doc.tags?.trim().length
- ? doc.tags
- ?.trim()
- .split(',')
- .map(t => `<span class="tag blue">${t.trim()}</span>`)
- .join('')
- : '',
- type: 'html',
- },
- last_update: { content: new Date(parseInt(doc.updated_timestamp)).toLocaleDateString() },
- status: { content: badges, type: 'html' },
- actions: { content: seeIcon + editIcon, type: 'link', to: `/dashboard/docs/${doc.id}` },
+ name: { content: doc.name, type: 'text' as const },
+ category: { content: categoriesStore.getById(doc.category || '')?.name || '', type: 'text' as const },
+ tags: { content: stringToBadge(doc.tags), type: 'html' as const },
+ last_update: { content: new Date(parseInt(doc.updated_timestamp)).toLocaleDateString(), type: 'text' as const },
+ status: { content: badges, type: 'html' as const },
+ actions: { type: 'slot' as const, data: { id: doc.id } },
};
}),
);
+
+function stringToBadge(str?: string): string {
+ if (str?.length)
+ return str
+ .trim()
+ .split(',')
+ .map(t => `<span class="tag blue">${t.trim()}</span>`)
+ .join('');
+ return '';
+}
</script>
diff --git a/frontend/pages/dashboard/docs/new.vue b/frontend/pages/dashboard/docs/new.vue
index 6c3b4043..bc6294be 100644
--- a/frontend/pages/dashboard/docs/new.vue
+++ b/frontend/pages/dashboard/docs/new.vue
@@ -18,7 +18,7 @@ definePageMeta({ breadcrumb: 'New' });
function save(doc: Document) {
store
.post(doc)
- .then(() => notifications.add({ title: 'Success:', message: 'Document posted', type: 'success', timeout: 5000 }))
- .catch(e => notifications.add({ title: 'Error:', message: e, type: 'error', timeout: 5000 }));
+ .then(() => notifications.add({ title: 'Success:', message: 'Document posted', type: 'success', timeout: 3000 }))
+ .catch(e => notifications.add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
}
</script>
diff --git a/frontend/pages/dashboard/settings.vue b/frontend/pages/dashboard/settings.vue
index ed2c341e..76e27b4a 100644
--- a/frontend/pages/dashboard/settings.vue
+++ b/frontend/pages/dashboard/settings.vue
@@ -154,8 +154,8 @@ const updateUser = async () => {
if (newAvatar) store.user.avatar = newAvatar;
store
.update(store.user)
- .then(() => useNotifications().add({ title: 'Success:', message: 'User updated', type: 'success', timeout: 5000 }))
- .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 5000 }));
+ .then(() => useNotifications().add({ title: 'Success:', message: 'User updated', type: 'success', timeout: 3000 }))
+ .catch(e => useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
};
const changePassword = async () => {
if (!store.user) return;
@@ -172,7 +172,7 @@ async function submitFile() {
const result = await makeRequest<{ url: string }>('backups', 'POST', {});
isLoading.value = false;
if (result.status != 'success') {
- return useNotifications().add({ type: 'error', title: 'Error', message: result.message, timeout: 5000 });
+ return useNotifications().add({ type: 'error', title: 'Error', message: result.message, timeout: 3000 });
}
downloadLink.value = `${CDN}${result.result?.url || ''}`;
}
diff --git a/frontend/styles/main.scss b/frontend/styles/main.scss
index 1ec73290..d49b15ac 100644
--- a/frontend/styles/main.scss
+++ b/frontend/styles/main.scss
@@ -57,16 +57,20 @@ body {
--padding: calc((100vw - 1700px) / 2);
}
-.backdrop {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 50;
- padding: 0;
- margin: 0;
- background-color: rgba(0, 0, 0, 0.5);
+.card-component {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 1.5rem;
+ padding: 1rem;
+ border-radius: 8px;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
+}
+
+@media screen and (min-width: 768px) {
+ .card-component {
+ padding: 2rem;
+ }
}
@media print {