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';
1919const mainNavItems : NavItem [ ] = [
2020 {
2121 title : 'Dashboard' ,
22- href : dashboard ( ) . url ,
22+ href : dashboard ( ) ,
2323 icon : LayoutGrid ,
2424 } ,
2525] ;
@@ -79,7 +79,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
7979 { rightNavItems . map ( ( item ) => (
8080 < a
8181 key = { item . title }
82- href = { item . href }
82+ href = { typeof item . href === 'string' ? item . href : item . href . url }
8383 target = "_blank"
8484 rel = "noopener noreferrer"
8585 className = "flex items-center space-x-2 font-medium"
@@ -109,7 +109,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
109109 href = { item . href }
110110 className = { cn (
111111 navigationMenuTriggerStyle ( ) ,
112- page . url === item . href && activeItemStyles ,
112+ page . url === ( typeof item . href === 'string' ? item . href : item . href . url ) && activeItemStyles ,
113113 'h-9 cursor-pointer px-3' ,
114114 ) }
115115 >
@@ -136,7 +136,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
136136 < Tooltip >
137137 < TooltipTrigger >
138138 < a
139- href = { item . href }
139+ href = { typeof item . href === 'string' ? item . href : item . href . url }
140140 target = "_blank"
141141 rel = "noopener noreferrer"
142142 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';
1111const mainNavItems : NavItem [ ] = [
1212 {
1313 title : 'Dashboard' ,
14- href : dashboard ( ) . url ,
14+ href : dashboard ( ) ,
1515 icon : LayoutGrid ,
1616 } ,
1717] ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export function NavFooter({
2020 asChild
2121 className = "text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100"
2222 >
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" >
2424 { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
2525 < span > { item . title } </ span >
2626 </ a >
Original file line number Diff line number Diff line change @@ -12,17 +12,17 @@ import { type PropsWithChildren } from 'react';
1212const sidebarNavItems : NavItem [ ] = [
1313 {
1414 title : 'Profile' ,
15- href : edit ( ) . url ,
15+ href : edit ( ) ,
1616 icon : null ,
1717 } ,
1818 {
1919 title : 'Password' ,
20- href : editPassword ( ) . url ,
20+ href : editPassword ( ) ,
2121 icon : null ,
2222 } ,
2323 {
2424 title : 'Appearance' ,
25- href : appearance ( ) . url ,
25+ href : appearance ( ) ,
2626 icon : null ,
2727 } ,
2828] ;
@@ -44,12 +44,12 @@ export default function SettingsLayout({ children }: PropsWithChildren) {
4444 < nav className = "flex flex-col space-y-1 space-x-0" >
4545 { sidebarNavItems . map ( ( item , index ) => (
4646 < Button
47- key = { `${ item . href } -${ index } ` }
47+ key = { `${ typeof item . href === 'string' ? item . href : item . href . url } -${ index } ` }
4848 size = "sm"
4949 variant = "ghost"
5050 asChild
5151 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 ) ,
5353 } ) }
5454 >
5555 < Link href = { item . href } prefetch >
Original file line number Diff line number Diff line change 1+ import { InertiaLinkProps } from '@inertiajs/react' ;
12import { LucideIcon } from 'lucide-react' ;
23
34export interface Auth {
@@ -16,7 +17,7 @@ export interface NavGroup {
1617
1718export interface NavItem {
1819 title : string ;
19- href : string ;
20+ href : NonNullable < InertiaLinkProps [ 'href' ] > ;
2021 icon ?: LucideIcon | null ;
2122 isActive ?: boolean ;
2223}
You can’t perform that action at this time.
0 commit comments