@@ -10,8 +10,9 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/co
10
10
import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from ' @/components/ui/tooltip' ;
11
11
import UserMenuContent from ' @/components/UserMenuContent.vue' ;
12
12
import { getInitials } from ' @/composables/useInitials' ;
13
+ import { dashboard } from ' @/routes' ;
13
14
import type { BreadcrumbItem , NavItem } from ' @/types' ;
14
- import { Link , usePage } from ' @inertiajs/vue3' ;
15
+ import { InertiaLinkProps , Link , usePage } from ' @inertiajs/vue3' ;
15
16
import { BookOpen , Folder , LayoutGrid , Menu , Search } from ' lucide-vue-next' ;
16
17
import { computed } from ' vue' ;
17
18
@@ -26,16 +27,17 @@ const props = withDefaults(defineProps<Props>(), {
26
27
const page = usePage ();
27
28
const auth = computed (() => page .props .auth );
28
29
29
- const isCurrentRoute = computed (() => (url : string ) => page .url === url );
30
+ const isCurrentRoute = computed (() => (url : NonNullable < InertiaLinkProps [ ' href ' ]> ) => page .url === ( typeof url === ' string ' ? url : url . url ) );
30
31
31
32
const activeItemStyles = computed (
32
- () => (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' : ' ' ,
33
35
);
34
36
35
37
const mainNavItems: NavItem [] = [
36
38
{
37
39
title: ' Dashboard' ,
38
- href: ' / dashboard' ,
40
+ href: dashboard () ,
39
41
icon: LayoutGrid ,
40
42
},
41
43
];
@@ -88,7 +90,7 @@ const rightNavItems: NavItem[] = [
88
90
<a
89
91
v-for =" item in rightNavItems"
90
92
:key =" item.title"
91
- :href =" item.href"
93
+ :href =" typeof item.href === 'string' ? item.href : item.href?.url "
92
94
target =" _blank"
93
95
rel =" noopener noreferrer"
94
96
class =" flex items-center space-x-2 text-sm font-medium"
@@ -102,7 +104,7 @@ const rightNavItems: NavItem[] = [
102
104
</Sheet >
103
105
</div >
104
106
105
- <Link :href =" route(' dashboard' )" class =" flex items-center gap-x-2" >
107
+ <Link :href =" dashboard( )" class =" flex items-center gap-x-2" >
106
108
<AppLogo />
107
109
</Link >
108
110
@@ -139,7 +141,11 @@ const rightNavItems: NavItem[] = [
139
141
<Tooltip >
140
142
<TooltipTrigger >
141
143
<Button variant =" ghost" size =" icon" as-child class =" group h-9 w-9 cursor-pointer" >
142
- <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
+ >
143
149
<span class =" sr-only" >{{ item.title }}</span >
144
150
<component :is =" item.icon" class =" size-5 opacity-80 group-hover:opacity-100" />
145
151
</a >
0 commit comments