π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Improve theme, colors, preferences, tree structure, design
Smaug6739396676879ddb
diff --git a/frontend/app/components/AppColorPicker.vue b/frontend/app/components/AppColorPicker.vueindex 933c887d..74d29dd6 100644--- a/frontend/app/components/AppColorPicker.vue+++ b/frontend/app/components/AppColorPicker.vue@@ -7,7 +7,22 @@:class="{ selected: selectedColor === -1 }"@click="selectColor(-1)"v-if="nullable"- ></div>+ >+ <div class="hint-wrapper">+ <p class="hint-tooltip">Unset</p>+ </div>+ </div>+ <div+ class="color-option"+ style="background-color: var(--default); border: 1px solid var(--default-border)"+ :style="{ outline: selectedColor == -2 ? '2px solid var(--default)' : '' }"+ :class="{ selected: selectedColor === -2 }"+ @click="selectColor(-2)"+ >+ <div class="hint-wrapper">+ <p class="hint-tooltip">Primary</p>+ </div>+ </div><divv-for="(_, index) in appColors":key="index"@@ -15,7 +30,13 @@:style="{ backgroundColor: getAppColor(index) ? `var(--${getAppColor(index)})` : '#fff', border: '1px solid var(--border-color)', outline: selectedColor === index ? `2px solid var(--${getAppColor(index)})` : 'none' }":class="{ selected: selectedColor === index }"@click="selectColor(index)"- ></div>+ >+ <div class="hint-wrapper">+ <p class="hint-tooltip">+ {{ getAppColor(index) }}+ </p>+ </div>+ </div></div></template>@@ -38,16 +59,40 @@ function selectColor(color: number) {gap: 8px;padding: 6px;border-radius: 6px;- border: 1px solid var(--border-color);}.color-option {- width: 24px;- height: 24px;+ width: 26px;+ height: 26px;border-radius: 50%;cursor: pointer;}.selected {outline-offset: 2px;}+.hint-wrapper {+ position: relative;+ margin-left: 0.25rem;+ display: inline-block;+}+.hint-tooltip {+ display: none;+ position: absolute;+ top: 100%;+ left: 50%;+ transform: translateX(-50%);+ margin-top: 0.4rem;+ background-color: #1f2937;+ color: white;+ padding: 0.4rem 0.6rem;+ border-radius: 0.4rem;+ white-space: nowrap;+ font-size: 0.75rem;+ z-index: 100;+ box-shadow: 0 2px 8px var(--shadow);+ text-transform: capitalize;+}+.color-option:hover .hint-tooltip {+ display: block;+}</style>diff --git a/frontend/app/components/AppSelect.vue b/frontend/app/components/AppSelect.vueindex b223756f..1e09f63f 100644--- a/frontend/app/components/AppSelect.vue+++ b/frontend/app/components/AppSelect.vue@@ -106,7 +106,7 @@ function handleBlur(event: FocusEvent) {position: relative;width: 200px;border: 1px solid var(--border-color);- border-radius: 5px;+ border-radius: 10px;&:focus {outline: 2px solid var(--border-color);}@@ -115,7 +115,7 @@ function handleBlur(event: FocusEvent) {button,.search-input {width: 100%;- padding: 8px;+ padding: 10px;text-align: left;font-size: 16px;cursor: pointer;@@ -140,7 +140,7 @@ button,overflow-y: auto;border: 1px solid var(--border-color);background: var(--bg-contrast);- border-radius: 4px;+ border-radius: 6px;margin-top: 4px;z-index: 1000;}diff --git a/frontend/app/components/AppSelectNode.vue b/frontend/app/components/AppSelectNode.vueindex 2778715b..b6de00d2 100644--- a/frontend/app/components/AppSelectNode.vue+++ b/frontend/app/components/AppSelectNode.vue@@ -1,8 +1,8 @@<template><li>- <button class="tree-node" :style="{ paddingLeft: `${level * 20 + 12}px`, fontWeight: node.childrens?.length ? 700 : 400 }" @click.stop="select" :disabled="disabled && disabled(node)">+ <div class="tree-node" :style="{ paddingLeft: `${level * 20 + 12}px`, fontWeight: node.childrens?.length ? 700 : 500 }" @click.stop="select" :disabled="disabled && disabled(node)">{{ node.label }}- </button>+ </div><ul v-if="node.childrens?.length"><AppSelectNode v-for="child in node.childrens" :key="child.id" :node="child" :level="level + 1" @select="$emit('select', $event)" :disabled="disabled" /></ul>@@ -27,11 +27,11 @@ function select() {<style scoped>.tree-node {display: block;- padding: 6px 12px;+ padding: 8px 12px;text-align: left;cursor: pointer;font-size: 15px;- width: calc(100% - 6px);+ width: 100%;margin: 0 auto;}diff --git a/frontend/app/components/DocumentCard.vue b/frontend/app/components/DocumentCard.vueindex 76f45df4..b31d9934 100644--- a/frontend/app/components/DocumentCard.vue+++ b/frontend/app/components/DocumentCard.vue@@ -3,7 +3,7 @@<div class="top"><div class="header"><span style="display: flex">- <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number)}`" /> <NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title">{{ document.name }}</NuxtLink>+ <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number, true)}`" /> <NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title">{{ document.name }}</NuxtLink></span><DocumentDotMenu :document="document" :user="user" @delete="deleteDoc" /></div>diff --git a/frontend/app/components/DocumentLine.vue b/frontend/app/components/DocumentLine.vueindex be57fd8b..1ae0ed52 100644--- a/frontend/app/components/DocumentLine.vue+++ b/frontend/app/components/DocumentLine.vue@@ -3,7 +3,7 @@<header style="display: flex; justify-content: space-between"><div style="display: flex; align-items: center; justify-content: flex-start"><div class="category-icon">- <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number) || 'primary'}`" />+ <Icon :name="category?.icon || 'files'" :class="`category-icon ${getAppColor(category?.color as number, true)}`" /></div><NuxtLink :to="`/dashboard/docs/${document.id}`" class="document-title">{{ document.name }}</NuxtLink></div>@@ -46,7 +46,7 @@ header {}.category-icon {margin-right: 5px;- padding: 4px 6px;+ padding: 6px;border-radius: 6px;}.document-title {diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vueindex a6da8421..0dd10bda 100644--- a/frontend/app/components/MarkdownEditor/Toolbar.vue+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue@@ -2,7 +2,7 @@<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" class="entry" v-if="!minimal" />- <AppSelect v-model="document.category" :items="categories" placeholder="Select category" size="220px" class="entry" v-if="!minimal" />+ <AppSelect v-model="document.category" :items="categories" placeholder="Select category" size="300px" class="entry" v-if="!minimal" /><input type="text" v-model="document.tags" placeholder="Tags" class="entry" /><AppHint text="Tags separated with a comma" /></div>diff --git a/frontend/app/composables/Preferences.ts b/frontend/app/composables/Preferences.tsindex 642eeced..e2399881 100644--- a/frontend/app/composables/Preferences.ts+++ b/frontend/app/composables/Preferences.ts@@ -17,7 +17,7 @@ const DEFAULT_PREFERENCES = {normalizeFileIcons: false,datatableItemsCount: 10,view_dock: true,- primaryColor: 0,+ primaryColor: -2, // -2 default primary; -1 unset; >= 0 app color indexdocSize: 1, // 0 = small, 1 = largesidebarCollapseItems: [],theme: 'alexandrie',diff --git a/frontend/app/composables/TreeStructure.ts b/frontend/app/composables/TreeStructure.tsindex 84dde039..478306d2 100644--- a/frontend/app/composables/TreeStructure.ts+++ b/frontend/app/composables/TreeStructure.ts@@ -4,7 +4,7 @@ import type { DefaultItem } from '../components/Sidebar/helpers';export interface ANode {id: string | number;label: string;- parent_id: string;+ parent_id?: string;childrens?: ANode[];}@@ -26,10 +26,10 @@ export class TreeStructure {this.childrenMap = new Map();for (const item of items) {- if (!this.childrenMap.has(item.parent_id)) {- this.childrenMap.set(item.parent_id, []);+ if (!this.childrenMap.has(item.parent_id || '')) {+ this.childrenMap.set(item.parent_id || '', []);}- this.childrenMap.get(item.parent_id)!.push(item);+ this.childrenMap.get(item.parent_id || '')!.push(item);}}@@ -41,7 +41,7 @@ export class TreeStructure {// Generate the tree structure without indexingpublic generateTree(): Item[] {return this.items- .filter(item => item.parent_id === '' || !this.itemMap.has(item.parent_id) || (item.data.type === 'category' && item.data.role === 2)) // Racines+ .filter(item => item.parent_id === '' || !this.itemMap.has(item.parent_id || '') || (item.data.type === 'category' && item.data.role === 2)) // Racines.map(rootItem => this.buildTree(rootItem));}public getSubTreeById(id: string): Item | undefined {diff --git a/frontend/app/composables/utils.ts b/frontend/app/composables/utils.tsindex 7f04a9e4..64a8d07c 100644--- a/frontend/app/composables/utils.ts+++ b/frontend/app/composables/utils.ts@@ -12,9 +12,9 @@ export function useAvatar(user?: User): string {return user?.avatar ? CDN + '/' + user.id + '/avatar' : '/default_avatar.avif';}-export const appColors = ['default', 'blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];-export function getAppColor(index: number = 0): string {- if (!index) return 'primary';+export const appColors = ['blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];+export function getAppColor(index: number = 0, defaultPrimary?: boolean): string {+ if (defaultPrimary && !index) return 'primary';return appColors[index % appColors.length] || 'primary';}diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vueindex 6ed04c2c..eb5b5d55 100644--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue@@ -2,18 +2,14 @@<h1>Preferences</h1><div v-for="(list, index) in options" :key="index"><h2>{{ list.label }}</h2>- <div v-for="(option, index) in list.options" class="form-group">+ <div v-for="(option, _) in list.options" class="form-group"><label>{{ option.label }}</label><!-- Toggle --><AppToggle v-if="option.type === 'toggle'" :active="option.value" @toggle="toggleOption(option)" /><!-- Native select -->- <select v-else-if="option.type === 'select'" v-model="option.value" @change="() => selectOption(option)">- <option v-for="choice in option.choices" :key="choice.value" :value="choice.value">- {{ choice.label }}- </option>- </select>+ <AppSelect v-else-if="option.type === 'select'" @update:model-value="option => selectOption(option)" :items="option.choices" v-model="option.value" size="40%" /><AppColorPicker v-else-if="option.type === 'color'" :selectedColor="option.value" @update:selected-color="option.onChange" /></div></div>@@ -53,7 +49,7 @@ interface ColorOption extends BaseOption {interface SelectOption extends BaseOption {type: 'select';value: number | string;- choices: { label: string; value: number | string }[];+ choices: ANode[];onChange?: (value: number | string) => void;}@@ -103,19 +99,19 @@ const options = ref<{ label: string; options: Option[] }[]>([value: preferencesStore.get('docSize'),storageKey: 'docSize',choices: [- { label: 'Large', value: 0 },- { label: 'Minimal', value: 1 },+ { label: 'Large', id: 0 },+ { label: 'Minimal', id: 1 },],},{label: 'Theme',type: 'select',- value: preferencesStore.get('theme'),+ value: preferencesStore.get('theme') as string,storageKey: 'theme',choices: [- { label: 'Alexandrie', value: 'alexandrie' },- { label: 'Latex style', value: 'latex' },- { label: 'Latex colored', value: 'latex-colored' },+ { label: 'Alexandrie', id: 'alexandrie' },+ { label: 'Latex style', id: 'latex' },+ { label: 'Latex colored', id: 'latex-colored' },],},],@@ -158,11 +154,11 @@ const options = ref<{ label: string; options: Option[] }[]>([value: preferencesStore.get('datatableItemsCount'),storageKey: 'datatableItemsCount',choices: [- { label: '10', value: 10 },- { label: '30', value: 30 },- { label: '50', value: 50 },- { label: '100', value: 100 },- { label: '250', value: 250 },+ { label: '10', id: 10 },+ { label: '30', id: 30 },+ { label: '50', id: 50 },+ { label: '100', id: 100 },+ { label: '250', id: 250 },],},],@@ -189,9 +185,13 @@ const selectOption = (option: SelectOption) => {gap: 1rem;margin-bottom: 1rem;}-+.entry {+}+h2 {+ font-size: 1.2em;+}label {- font-weight: 500;+ font-weight: 700;flex: 1;}diff --git a/frontend/app/styles/_variables.scss b/frontend/app/styles/_variables.scssindex 6717edf1..6f78bf3e 100644--- a/frontend/app/styles/_variables.scss+++ b/frontend/app/styles/_variables.scss@@ -42,7 +42,7 @@ $primary-dark: color.adjust(#6024ec, $lightness: -10%);--bg-soft: #fafafa;--bg-color: #fff;- --bg-contrast: #f3f3f3;+ --bg-contrast: #f5f5f7;--bg-contrast-2: #e2ebfd;--selection-color: #dde3e9;--font-color: #3c4450;diff --git a/frontend/app/styles/theme.scss b/frontend/app/styles/theme.scssindex e554759e..65789e51 100644--- a/frontend/app/styles/theme.scss+++ b/frontend/app/styles/theme.scss@@ -101,12 +101,12 @@ img {input,select,textarea {- padding: 8px;+ padding: 10px;margin: 0;background: var(--bg-color);border: 1px solid var(--border-color);color: var(--font-color);- border-radius: 6px;+ border-radius: 8px;font-size: 1rem;&:disabled {