File tree Expand file tree Collapse file tree 5 files changed +13
-12
lines changed Expand file tree Collapse file tree 5 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import AppLogoIcon from './app-logo-icon';
19
19
const mainNavItems : NavItem [ ] = [
20
20
{
21
21
title : 'Dashboard' ,
22
- href : dashboard ( ) . url ,
22
+ href : dashboard ( ) ,
23
23
icon : LayoutGrid ,
24
24
} ,
25
25
] ;
@@ -79,7 +79,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
79
79
{ rightNavItems . map ( ( item ) => (
80
80
< a
81
81
key = { item . title }
82
- href = { item . href }
82
+ href = { typeof item . href === 'string' ? item . href : item . href . url }
83
83
target = "_blank"
84
84
rel = "noopener noreferrer"
85
85
className = "flex items-center space-x-2 font-medium"
@@ -109,7 +109,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
109
109
href = { item . href }
110
110
className = { cn (
111
111
navigationMenuTriggerStyle ( ) ,
112
- page . url === item . href && activeItemStyles ,
112
+ page . url === ( typeof item . href === 'string' ? item . href : item . href . url ) && activeItemStyles ,
113
113
'h-9 cursor-pointer px-3' ,
114
114
) }
115
115
>
@@ -136,7 +136,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
136
136
< Tooltip >
137
137
< TooltipTrigger >
138
138
< a
139
- href = { item . href }
139
+ href = { typeof item . href === 'string' ? item . href : item . href . url }
140
140
target = "_blank"
141
141
rel = "noopener noreferrer"
142
142
className = "group ml-1 inline-flex h-9 w-9 items-center justify-center rounded-md bg-transparent p-0 text-sm font-medium text-accent-foreground ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import AppLogo from './app-logo';
11
11
const mainNavItems : NavItem [ ] = [
12
12
{
13
13
title : 'Dashboard' ,
14
- href : dashboard ( ) . url ,
14
+ href : dashboard ( ) ,
15
15
icon : LayoutGrid ,
16
16
} ,
17
17
] ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export function NavFooter({
20
20
asChild
21
21
className = "text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100"
22
22
>
23
- < a href = { item . href } target = "_blank" rel = "noopener noreferrer" >
23
+ < a href = { typeof item . href === 'string' ? item . href : item . href . url } target = "_blank" rel = "noopener noreferrer" >
24
24
{ item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
25
25
< span > { item . title } </ span >
26
26
</ a >
Original file line number Diff line number Diff line change @@ -12,17 +12,17 @@ import { type PropsWithChildren } from 'react';
12
12
const sidebarNavItems : NavItem [ ] = [
13
13
{
14
14
title : 'Profile' ,
15
- href : edit ( ) . url ,
15
+ href : edit ( ) ,
16
16
icon : null ,
17
17
} ,
18
18
{
19
19
title : 'Password' ,
20
- href : editPassword ( ) . url ,
20
+ href : editPassword ( ) ,
21
21
icon : null ,
22
22
} ,
23
23
{
24
24
title : 'Appearance' ,
25
- href : appearance ( ) . url ,
25
+ href : appearance ( ) ,
26
26
icon : null ,
27
27
} ,
28
28
] ;
@@ -44,12 +44,12 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
44
44
< nav className = "flex flex-col space-y-1 space-x-0" >
45
45
{ sidebarNavItems . map ( ( item , index ) => (
46
46
< Button
47
- key = { `${ item . href } -${ index } ` }
47
+ key = { `${ typeof item . href === 'string' ? item . href : item . href . url } -${ index } ` }
48
48
size = "sm"
49
49
variant = "ghost"
50
50
asChild
51
51
className = { cn ( 'w-full justify-start' , {
52
- 'bg-muted' : currentPath === item . href ,
52
+ 'bg-muted' : currentPath === ( typeof item . href === 'string' ? item . href : item . href . url ) ,
53
53
} ) }
54
54
>
55
55
< Link href = { item . href } prefetch >
Original file line number Diff line number Diff line change
1
+ import { InertiaLinkProps } from '@inertiajs/react' ;
1
2
import { LucideIcon } from 'lucide-react' ;
2
3
3
4
export interface Auth {
@@ -16,7 +17,7 @@ export interface NavGroup {
16
17
17
18
export interface NavItem {
18
19
title : string ;
19
- href : string ;
20
+ href : NonNullable < InertiaLinkProps [ 'href' ] > ;
20
21
icon ?: LucideIcon | null ;
21
22
isActive ?: boolean ;
22
23
}
You can’t perform that action at this time.
0 commit comments