Skip to content

Commit 4025c22

Browse files
author
Lasim
committed
refactor: clean up code structure and remove redundant sections
1 parent 7f95f3e commit 4025c22

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

.assets/deploystack-banner.png

113 KB
Loading
-37.2 KB
Binary file not shown.
-92.6 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p align="center">
44
<a href="https://deploystack.io">
5-
<img src="./.assets/deploystack-characteristics.webp" alt="DeployStack Logo" />
5+
<img src="./.assets/deploystack-banner.png" alt="DeployStack Logo" />
66
</a>
77
</p>
88

services/frontend/src/components/AppSidebar.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ const navigationItems = [
105105
// },
106106
]
107107
108+
// Helper function to check if a route is active
109+
const isRouteActive = (url: string) => {
110+
const currentPath = router.currentRoute.value.path
111+
112+
// Special case: '/teams' should only match exactly '/teams', not '/teams/manage/...'
113+
if (url === '/teams') {
114+
return currentPath === '/teams'
115+
}
116+
117+
// For all other routes, use startsWith for sub-route matching
118+
return currentPath.startsWith(url)
119+
}
120+
108121
// Fetch user data logic using UserService
109122
const fetchUserData = async (forceRefresh = false) => {
110123
try {
@@ -280,9 +293,8 @@ onUnmounted(() => {
280293
<SidebarMenuItem v-for="item in navigationItems" :key="item.title">
281294
<SidebarMenuButton
282295
@click="navigateTo(item.url)"
283-
:is-active="router.currentRoute.value.path === item.url"
296+
:is-active="isRouteActive(item.url)"
284297
class="w-full justify-start"
285-
:aria-current="router.currentRoute.value.path === item.url ? 'page' : undefined"
286298
>
287299
<component :is="item.icon" class="mr-2 h-4 w-4 shrink-0" />
288300
<span>{{ item.title }}</span>
@@ -299,9 +311,8 @@ onUnmounted(() => {
299311
<SidebarMenuItem v-for="item in teamItems" :key="item.title">
300312
<SidebarMenuButton
301313
@click="navigateTo(item.url)"
302-
:is-active="router.currentRoute.value.path === item.url"
314+
:is-active="isRouteActive(item.url)"
303315
class="w-full justify-start"
304-
:aria-current="router.currentRoute.value.path === item.url ? 'page' : undefined"
305316
>
306317
<component :is="item.icon" class="mr-2 h-4 w-4 shrink-0" />
307318
<span>{{ item.title }}</span>
@@ -319,9 +330,8 @@ onUnmounted(() => {
319330
<SidebarMenuItem>
320331
<SidebarMenuButton
321332
@click="navigateTo('/admin/settings')"
322-
:is-active="router.currentRoute.value.path === '/admin/settings'"
333+
:is-active="router.currentRoute.value.path.startsWith('/admin/settings')"
323334
class="w-full justify-start"
324-
:aria-current="router.currentRoute.value.path === '/admin/settings' ? 'page' : undefined"
325335
>
326336
<FileSliders class="mr-2 h-4 w-4 shrink-0" />
327337
<span>{{ t('sidebar.adminArea.globalSettings') }}</span>
@@ -330,9 +340,8 @@ onUnmounted(() => {
330340
<SidebarMenuItem>
331341
<SidebarMenuButton
332342
@click="navigateTo('/admin/users')"
333-
:is-active="router.currentRoute.value.path === '/admin/users'"
343+
:is-active="router.currentRoute.value.path.startsWith('/admin/users')"
334344
class="w-full justify-start"
335-
:aria-current="router.currentRoute.value.path === '/admin/users' ? 'page' : undefined"
336345
>
337346
<Users class="mr-2 h-4 w-4 shrink-0" />
338347
<span>{{ t('sidebar.adminArea.users') }}</span>
@@ -343,7 +352,6 @@ onUnmounted(() => {
343352
@click="navigateTo('/admin/mcp-server-catalog')"
344353
:is-active="router.currentRoute.value.path.startsWith('/admin/mcp-server-catalog')"
345354
class="w-full justify-start"
346-
:aria-current="router.currentRoute.value.path.startsWith('/admin/mcp-server-catalog') ? 'page' : undefined"
347355
>
348356
<Server class="mr-2 h-4 w-4 shrink-0" />
349357
<span>{{ t('sidebar.adminArea.mcpCatalog') }}</span>
@@ -354,7 +362,6 @@ onUnmounted(() => {
354362
@click="navigateTo('/admin/mcp-categories')"
355363
:is-active="router.currentRoute.value.path.startsWith('/admin/mcp-categories')"
356364
class="w-full justify-start"
357-
:aria-current="router.currentRoute.value.path.startsWith('/admin/mcp-categories') ? 'page' : undefined"
358365
>
359366
<FolderTree class="mr-2 h-4 w-4 shrink-0" />
360367
<span>{{ t('sidebar.adminArea.mcpCategories') }}</span>
@@ -365,7 +372,6 @@ onUnmounted(() => {
365372
@click="navigateTo('/admin/satellites')"
366373
:is-active="router.currentRoute.value.path.startsWith('/admin/satellites')"
367374
class="w-full justify-start"
368-
:aria-current="router.currentRoute.value.path.startsWith('/admin/satellites') ? 'page' : undefined"
369375
>
370376
<Satellite class="mr-2 h-4 w-4 shrink-0" />
371377
<span>{{ t('sidebar.adminArea.satellites') }}</span>
@@ -376,7 +382,6 @@ onUnmounted(() => {
376382
@click="navigateTo('/admin/jobs')"
377383
:is-active="router.currentRoute.value.path.startsWith('/admin/jobs')"
378384
class="w-full justify-start"
379-
:aria-current="router.currentRoute.value.path.startsWith('/admin/jobs') ? 'page' : undefined"
380385
>
381386
<ListTodo class="mr-2 h-4 w-4 shrink-0" />
382387
<span>{{ t('sidebar.adminArea.backgroundJobs') }}</span>

services/frontend/src/components/ui/sidebar/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export { default as SidebarTrigger } from './SidebarTrigger.vue'
3636
export { useSidebar } from './utils'
3737

3838
export const sidebarMenuButtonVariants = cva(
39-
'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
39+
'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-white data-[active=true]:border data-[active=true]:border-sidebar-foreground/20 data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
4040
{
4141
variants: {
4242
variant: {

0 commit comments

Comments
 (0)