@@ -12,7 +12,7 @@ import UserMenuContent from '@/components/UserMenuContent.vue';
1212import { getInitials } from ' @/composables/useInitials' ;
1313import { dashboard } from ' @/routes' ;
1414import type { BreadcrumbItem , NavItem } from ' @/types' ;
15- import { Link , usePage } from ' @inertiajs/vue3' ;
15+ import { InertiaLinkProps , Link , usePage } from ' @inertiajs/vue3' ;
1616import { BookOpen , Folder , LayoutGrid , Menu , Search } from ' lucide-vue-next' ;
1717import { computed } from ' vue' ;
1818
@@ -27,16 +27,17 @@ const props = withDefaults(defineProps<Props>(), {
2727const page = usePage ();
2828const auth = computed (() => page .props .auth );
2929
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 ) );
3131
3232const 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' : ' ' ,
3435);
3536
3637const mainNavItems: NavItem [] = [
3738 {
3839 title: ' Dashboard' ,
39- href: dashboard (). url ,
40+ href: dashboard (),
4041 icon: LayoutGrid ,
4142 },
4243];
@@ -89,7 +90,7 @@ const rightNavItems: NavItem[] = [
8990 <a
9091 v-for =" item in rightNavItems"
9192 :key =" item.title"
92- :href =" item.href"
93+ :href =" typeof item.href === 'string' ? item.href : item.href?.url "
9394 target =" _blank"
9495 rel =" noopener noreferrer"
9596 class =" flex items-center space-x-2 text-sm font-medium"
@@ -140,7 +141,11 @@ const rightNavItems: NavItem[] = [
140141 <Tooltip >
141142 <TooltipTrigger >
142143 <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+ >
144149 <span class =" sr-only" >{{ item.title }}</span >
145150 <component :is =" item.icon" class =" size-5 opacity-80 group-hover:opacity-100" />
146151 </a >
0 commit comments