@@ -10,6 +10,7 @@ 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 { toUrl , urlIsActive } from ' @/lib/utils' ;
1314import { dashboard } from ' @/routes' ;
1415import type { BreadcrumbItem , NavItem } from ' @/types' ;
1516import { InertiaLinkProps , Link , usePage } from ' @inertiajs/vue3' ;
@@ -27,11 +28,11 @@ const props = withDefaults(defineProps<Props>(), {
2728const page = usePage ();
2829const auth = computed (() => page .props .auth );
2930
30- const isCurrentRoute = computed (() => (url : NonNullable <InertiaLinkProps [' href' ]>) => page . url === ( typeof url === ' string ' ? url : url .url ));
31+ const isCurrentRoute = computed (() => (url : NonNullable <InertiaLinkProps [' href' ]>) => urlIsActive ( url , page .url ));
3132
3233const activeItemStyles = computed (
3334 () => (url : NonNullable <InertiaLinkProps [' href' ]>) =>
34- isCurrentRoute .value (typeof url === ' string ' ? url : url . url ) ? ' text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' ' ,
35+ isCurrentRoute .value (toUrl ( url ) ) ? ' text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' : ' ' ,
3536);
3637
3738const mainNavItems: NavItem [] = [
@@ -90,7 +91,7 @@ const rightNavItems: NavItem[] = [
9091 <a
9192 v-for =" item in rightNavItems"
9293 :key =" item.title"
93- :href =" typeof item.href === 'string' ? item.href : item.href?.url "
94+ :href =" toUrl( item.href) "
9495 target =" _blank"
9596 rel =" noopener noreferrer"
9697 class =" flex items-center space-x-2 text-sm font-medium"
@@ -141,11 +142,7 @@ const rightNavItems: NavItem[] = [
141142 <Tooltip >
142143 <TooltipTrigger >
143144 <Button variant =" ghost" size =" icon" as-child class =" group h-9 w-9 cursor-pointer" >
144- <a
145- :href =" typeof item.href === 'string' ? item.href : item.href?.url"
146- target =" _blank"
147- rel =" noopener noreferrer"
148- >
145+ <a :href =" toUrl(item.href)" target =" _blank" rel =" noopener noreferrer" >
149146 <span class =" sr-only" >{{ item.title }}</span >
150147 <component :is =" item.icon" class =" size-5 opacity-80 group-hover:opacity-100" />
151148 </a >
0 commit comments