@@ -10,8 +10,9 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/co
1010import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from ' @/components/ui/tooltip' ;
1111import UserMenuContent from ' @/components/UserMenuContent.vue' ;
1212import { getInitials } from ' @/composables/useInitials' ;
13+ import { dashboard } from ' @/routes' ;
1314import type { BreadcrumbItem , NavItem } from ' @/types' ;
14- import { Link , usePage } from ' @inertiajs/vue3' ;
15+ import { InertiaLinkProps , Link , usePage } from ' @inertiajs/vue3' ;
1516import { BookOpen , Folder , LayoutGrid , Menu , Search } from ' lucide-vue-next' ;
1617import { computed } from ' vue' ;
1718
@@ -26,16 +27,17 @@ const props = withDefaults(defineProps<Props>(), {
2627const page = usePage ();
2728const auth = computed (() => page .props .auth );
2829
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 ) );
3031
3132const 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' : ' ' ,
3335);
3436
3537const mainNavItems: NavItem [] = [
3638 {
3739 title: ' Dashboard' ,
38- href: ' / dashboard' ,
40+ href: dashboard () ,
3941 icon: LayoutGrid ,
4042 },
4143];
@@ -88,7 +90,7 @@ const rightNavItems: NavItem[] = [
8890 <a
8991 v-for =" item in rightNavItems"
9092 :key =" item.title"
91- :href =" item.href"
93+ :href =" typeof item.href === 'string' ? item.href : item.href?.url "
9294 target =" _blank"
9395 rel =" noopener noreferrer"
9496 class =" flex items-center space-x-2 text-sm font-medium"
@@ -102,7 +104,7 @@ const rightNavItems: NavItem[] = [
102104 </Sheet >
103105 </div >
104106
105- <Link :href =" route(' dashboard' )" class =" flex items-center gap-x-2" >
107+ <Link :href =" dashboard( )" class =" flex items-center gap-x-2" >
106108 <AppLogo />
107109 </Link >
108110
@@ -139,7 +141,11 @@ const rightNavItems: NavItem[] = [
139141 <Tooltip >
140142 <TooltipTrigger >
141143 <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+ >
143149 <span class =" sr-only" >{{ item.title }}</span >
144150 <component :is =" item.icon" class =" size-5 opacity-80 group-hover:opacity-100" />
145151 </a >
0 commit comments