From fcaea9f3e2bfce4ec0ec614f6d3bf50852f5b86c Mon Sep 17 00:00:00 2001 From: "marcel.kocisek" Date: Fri, 25 Oct 2024 11:46:29 +0200 Subject: [PATCH 1/2] Added ability to handle anchor links in sidebar --- .../src/modules/layout/components/SideBarItem.vue | 15 +++++++++++++++ .../modules/layout/components/SideBarTemplate.vue | 15 +++++++++++++-- web-app/packages/lib/src/modules/layout/types.ts | 3 ++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/web-app/packages/lib/src/modules/layout/components/SideBarItem.vue b/web-app/packages/lib/src/modules/layout/components/SideBarItem.vue index 8198ac79..57c26f38 100644 --- a/web-app/packages/lib/src/modules/layout/components/SideBarItem.vue +++ b/web-app/packages/lib/src/modules/layout/components/SideBarItem.vue @@ -21,6 +21,7 @@ function closeDrawer() { diff --git a/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue b/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue index 60c9fa37..c0404548 100644 --- a/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue +++ b/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue @@ -75,13 +75,14 @@ import { useRoute } from 'vue-router' import { SideBarItemModel } from '../types' -import { DashboardRouteName } from '@/main' +import { DashboardRouteName, useUserStore } from '@/main' import SideBarItem from '@/modules/layout/components/SideBarItem.vue' import { useLayoutStore } from '@/modules/layout/store' import { ProjectRouteName } from '@/modules/project' const route = useRoute() const layoutStore = useLayoutStore() +const userStore = useUserStore() const props = defineProps<{ sidebarItems?: SideBarItemModel[] }>() @@ -106,7 +107,17 @@ const initialSidebarItems = computed(() => { title: 'Projects', to: '/projects', icon: 'ti ti-article' - } + }, + ...(userStore.isSuperUser + ? [ + { + active: false, + title: 'Administration', + href: '/admin', + icon: 'ti ti-home-cog' + } + ] + : []) ] ) }) diff --git a/web-app/packages/lib/src/modules/layout/types.ts b/web-app/packages/lib/src/modules/layout/types.ts index 9adff558..38b3e873 100644 --- a/web-app/packages/lib/src/modules/layout/types.ts +++ b/web-app/packages/lib/src/modules/layout/types.ts @@ -4,7 +4,8 @@ export interface SideBarItemModel { title: string - to: string + to?: string + href?: string icon: string active: boolean } From 06c11171f3338259b9c684784e07c976dd11bf19 Mon Sep 17 00:00:00 2001 From: "marcel.kocisek" Date: Mon, 28 Oct 2024 13:13:50 +0100 Subject: [PATCH 2/2] added sidebar footer to admin --- web-app/packages/admin-app/components.d.ts | 2 +- .../src/modules/layout/components/Sidebar.vue | 5 +++- web-app/packages/admin-lib/components.d.ts | 1 + .../packages/admin-lib/src/modules/index.ts | 1 + .../layout/components/SidebarFooter.vue | 11 ++++++++ .../src/modules/layout/components/index.ts | 5 ++++ .../admin-lib/src/modules/layout/index.ts | 5 ++++ .../layout/components/SideBarTemplate.vue | 25 +++++++++---------- 8 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 web-app/packages/admin-lib/src/modules/layout/components/SidebarFooter.vue create mode 100644 web-app/packages/admin-lib/src/modules/layout/components/index.ts create mode 100644 web-app/packages/admin-lib/src/modules/layout/index.ts diff --git a/web-app/packages/admin-app/components.d.ts b/web-app/packages/admin-app/components.d.ts index 97368df8..6bcacfd1 100644 --- a/web-app/packages/admin-app/components.d.ts +++ b/web-app/packages/admin-app/components.d.ts @@ -1,10 +1,10 @@ /* eslint-disable */ -/* prettier-ignore */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 export {} +/* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { PDivider: typeof import('primevue/divider')['default'] diff --git a/web-app/packages/admin-app/src/modules/layout/components/Sidebar.vue b/web-app/packages/admin-app/src/modules/layout/components/Sidebar.vue index cccd4d1d..ffb15e66 100644 --- a/web-app/packages/admin-app/src/modules/layout/components/Sidebar.vue +++ b/web-app/packages/admin-app/src/modules/layout/components/Sidebar.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: LicenseRef-MerginMaps-Commercial --> diff --git a/web-app/packages/admin-lib/src/modules/layout/components/index.ts b/web-app/packages/admin-lib/src/modules/layout/components/index.ts new file mode 100644 index 00000000..dcf4179e --- /dev/null +++ b/web-app/packages/admin-lib/src/modules/layout/components/index.ts @@ -0,0 +1,5 @@ +// Copyright (C) Lutra Consulting Limited +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial + +export { default as SidebarFooter } from './SidebarFooter.vue' diff --git a/web-app/packages/admin-lib/src/modules/layout/index.ts b/web-app/packages/admin-lib/src/modules/layout/index.ts new file mode 100644 index 00000000..d333dd14 --- /dev/null +++ b/web-app/packages/admin-lib/src/modules/layout/index.ts @@ -0,0 +1,5 @@ +// Copyright (C) Lutra Consulting Limited +// +// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial + +export * from './components' diff --git a/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue b/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue index c0404548..813e2a79 100644 --- a/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue +++ b/web-app/packages/lib/src/modules/layout/components/SideBarTemplate.vue @@ -60,11 +60,20 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial -
+
+ -
+ @@ -107,17 +116,7 @@ const initialSidebarItems = computed(() => { title: 'Projects', to: '/projects', icon: 'ti ti-article' - }, - ...(userStore.isSuperUser - ? [ - { - active: false, - title: 'Administration', - href: '/admin', - icon: 'ti ti-home-cog' - } - ] - : []) + } ] ) })