π 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
refactor modal categories
Smaug6739ee54761f18e7
diff --git a/frontend/app/components/CommandCenter/index.vue b/frontend/app/components/CommandCenter/index.vueindex bbb79c4c..99f8f5bd 100644--- a/frontend/app/components/CommandCenter/index.vue+++ b/frontend/app/components/CommandCenter/index.vue@@ -56,7 +56,7 @@</template><script setup lang="ts">-import CreateCategoryModal from '~/pages/dashboard/categories/_modals/CreateCategoryModal.vue';+import CreateCategoryModal from '~/components/Node/Modals/CreateCategory.vue';import TabNavigation from './TabNavigation.vue';import QuickSearchTab from './QuickSearchTab.vue';import AdvancedSearchTab from './AdvancedSearchTab.vue';@@ -214,7 +214,9 @@ watch(searchQuery, () => (selectedIndex.value = 0));.modal-enter-active,.modal-leave-active {- transition: opacity 0.3s ease, transform 0.3s ease;+ transition:+ opacity 0.3s ease,+ transform 0.3s ease;}.modal-enter-from,diff --git a/frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vue b/frontend/app/components/Node/Modals/CreateCategory.vuesimilarity index 100%rename from frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vuerename to frontend/app/components/Node/Modals/CreateCategory.vuediff --git a/frontend/app/components/Sidebar/Sidebar.vue b/frontend/app/components/Sidebar/Sidebar.vueindex d7da742d..eaca366e 100644--- a/frontend/app/components/Sidebar/Sidebar.vue+++ b/frontend/app/components/Sidebar/Sidebar.vue@@ -60,7 +60,7 @@ import Resizable from './Resizable.vue';import IconClose from './IconClose.vue';import SidebarSkeleton from './SidebarSkeleton.vue';import { navigationItems } from './helpers';-import NewCategoryModal from '~/pages/dashboard/categories/_modals/CreateCategoryModal.vue';+import NewCategoryModal from '~/components/Node/Modals/CreateCategory.vue';import Dock from './Dock.vue';const nodesStore = useNodesStore();diff --git a/frontend/app/components/Sidebar/SidebarWorkspaces.vue b/frontend/app/components/Sidebar/SidebarWorkspaces.vueindex a1a99c66..a9e32c4e 100644--- a/frontend/app/components/Sidebar/SidebarWorkspaces.vue+++ b/frontend/app/components/Sidebar/SidebarWorkspaces.vue@@ -28,7 +28,7 @@</template><script setup lang="ts">import SidebarWorkspace from './SidebarWorkspace.vue';-import NewCategoryModal from '~/pages/dashboard/categories/_modals/CreateCategoryModal.vue';+import NewCategoryModal from '~/components/Node/Modals/CreateCategory.vue';import type { Workspace } from './helpers';@@ -122,7 +122,9 @@ const create_workspace = (_: MouseEvent) => useModal().add(new Modal(shallowRef(border-radius: 10px;color: var(--font-color);background-color: var(--bg-color);- box-shadow: 0 8px 24px var(--shadow), 0 2px 8px var(--shadow);+ box-shadow:+ 0 8px 24px var(--shadow),+ 0 2px 8px var(--shadow);animation: slideDown 0.15s ease-out;list-style: none;overflow-y: auto;diff --git a/frontend/app/pages/dashboard/categories/[id]/edit.vue b/frontend/app/pages/dashboard/categories/[id]/edit.vueindex d94e5d4d..60ec1f85 100644--- a/frontend/app/pages/dashboard/categories/[id]/edit.vue+++ b/frontend/app/pages/dashboard/categories/[id]/edit.vue@@ -20,7 +20,7 @@v-model="category.parent_id":items="categoriesItem"placeholder="Select a category parent"- :disabled="(i) => i.id == category!.id || nodesStore.isDescendant(category!, (i as Item).id)"+ :disabled="i => i.id == category!.id || nodesStore.isDescendant(category!, (i as Item).id)"/></div><div class="form-column">@@ -44,7 +44,7 @@<script lang="ts" setup>import { CATEGORY_ROLES } from '~/helpers/constants';-import DeleteModal from '../_modals/DeleteCategoryModal.vue';+import DeleteModal from '~/components/Node/Modals/Delete.vue';definePageMeta({ breadcrumb: 'Edit' });diff --git a/frontend/app/pages/dashboard/categories/_modals/DeleteCategoryModal.vue b/frontend/app/pages/dashboard/categories/_modals/DeleteCategoryModal.vuedeleted file mode 100644index 5a3bf249..00000000--- a/frontend/app/pages/dashboard/categories/_modals/DeleteCategoryModal.vue+++ /dev/null@@ -1,39 +0,0 @@-<template>- <div class="modal">- <h3>Delete category</h3>- <p>Are you sure you want to delete this category ?</p>- <p style="opacity: 0.7">This action is irreversible</p>- <p v-if="allChildren.length > 0" class="warn">This category has {{ allChildren.length }} child documents/categories. They will be deleted too.</p>- <p v-else class="warn">If this category has children, they will be deleted too.</p>- <div class="footer">- <AppButton type="secondary" @click="emit('close')">Cancel</AppButton>- <AppButton type="danger" @click="deleteDoc">Confirm</AppButton>- </div>- </div>-</template>--<script setup lang="ts">-const props = defineProps<{ categoryId: string }>();-const emit = defineEmits(['close']);--const deleteDoc = () => {- useNodesStore()- .delete(props.categoryId)- .then(() => {- useNotifications().add({ type: 'success', title: 'Category successfully deleted' });- emit('close');- useRouter().push('/dashboard/categories');- })- .catch(e => {- useNotifications().add({ type: 'error', title: 'Error during deletion', message: e });- });-};-const allChildren = useSidebarTree().getSubTreeById(props.categoryId);-</script>--<style scoped lang="scss">-.warn {- color: var(--red)-dark;- opacity: 0.7;-}-</style>diff --git a/frontend/app/pages/dashboard/categories/index.vue b/frontend/app/pages/dashboard/categories/index.vueindex bebba9cf..6a8ebac5 100644--- a/frontend/app/pages/dashboard/categories/index.vue+++ b/frontend/app/pages/dashboard/categories/index.vue@@ -26,8 +26,8 @@</template><script setup lang="ts">-import CreateCategoryModal from './_modals/CreateCategoryModal.vue';-import DeleteCategoryModal from './_modals/DeleteCategoryModal.vue';+import CreateCategoryModal from '~/components/Node/Modals/CreateCategory.vue';+import DeleteCategoryModal from '~/components/Node/Modals/Delete.vue';import WorkspaceTree from './_components/WorkspaceTree.vue';import type { Node } from '~/stores';diff --git a/frontend/app/pages/dashboard/home.vue b/frontend/app/pages/dashboard/home.vueindex e9e4b05e..d9dd8ad5 100644--- a/frontend/app/pages/dashboard/home.vue+++ b/frontend/app/pages/dashboard/home.vue@@ -141,7 +141,7 @@<script setup lang="ts">import { resolveIcon, resolveNodeLink, resolveNodeType } from '~/helpers/node';-import CreateCategoryModal from '~/pages/dashboard/categories/_modals/CreateCategoryModal.vue';+import CreateCategoryModal from '~/components/Node/Modals/CreateCategory.vue';import type { Node } from '~/stores';const router = useRouter();