@@ -12,7 +12,7 @@ import UserMenuContent from '@/components/UserMenuContent.vue';
12
12
import { getInitials } from ' @/composables/useInitials' ;
13
13
import { dashboard } from ' @/routes' ;
14
14
import type { BreadcrumbItem , NavItem } from ' @/types' ;
15
- import { Link , usePage } from ' @inertiajs/vue3' ;
15
+ import { InertiaLinkProps , Link , usePage } from ' @inertiajs/vue3' ;
16
16
import { BookOpen , Folder , LayoutGrid , Menu , Search } from ' lucide-vue-next' ;
17
17
import { computed } from ' vue' ;
18
18
@@ -27,16 +27,17 @@ const props = withDefaults(defineProps<Props>(), {
27
27
const page = usePage ();
28
28
const auth = computed (() => page .props .auth );
29
29
30
- const isCurrentRoute = computed (() => (url : string ) => page .url === url );
30
+ const isCurrentRoute = computed (() => (url : NonNullable < InertiaLinkProps [ ' href ' ]> ) => page .url === ( typeof url === ' string ' ? url : url . url ) );
31
31
32
32
const activeItemStyles = computed (
33
- () => (url : string ) => (isCurrentRoute .value (url ) ? ' text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' ' ),
33
+ () => (url : NonNullable <InertiaLinkProps [' href' ]>) =>
34
+ isCurrentRoute .value (typeof url === ' string' ? url : url .url ) ? ' text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' ' ,
34
35
);
35
36
36
37
const mainNavItems: NavItem [] = [
37
38
{
38
39
title: ' Dashboard' ,
39
- href: dashboard (). url ,
40
+ href: dashboard (),
40
41
icon: LayoutGrid ,
41
42
},
42
43
];
@@ -89,7 +90,7 @@ const rightNavItems: NavItem[] = [
89
90
<a
90
91
v-for =" item in rightNavItems"
91
92
:key =" item.title"
92
- :href =" item.href"
93
+ :href =" typeof item.href === 'string' ? item.href : item.href?.url "
93
94
target =" _blank"
94
95
rel =" noopener noreferrer"
95
96
class =" flex items-center space-x-2 text-sm font-medium"
@@ -140,7 +141,11 @@ const rightNavItems: NavItem[] = [
140
141
<Tooltip >
141
142
<TooltipTrigger >
142
143
<Button variant =" ghost" size =" icon" as-child class =" group h-9 w-9 cursor-pointer" >
143
- <a :href =" item.href" target =" _blank" rel =" noopener noreferrer" >
144
+ <a
145
+ :href =" typeof item.href === 'string' ? item.href : item.href?.url"
146
+ target =" _blank"
147
+ rel =" noopener noreferrer"
148
+ >
144
149
<span class =" sr-only" >{{ item.title }}</span >
145
150
<component :is =" item.icon" class =" size-5 opacity-80 group-hover:opacity-100" />
146
151
</a >
0 commit comments