1+ import { Link , usePage } from '@inertiajs/react' ;
2+ import { type BreadcrumbItem } from '@/types' ;
3+ import AppLogo from './app-logo' ;
4+ import AppLogoIcon from './app-logo-icon' ;
5+ import { Button } from "@/components/ui/button"
16import { Breadcrumbs } from '@/components/breadcrumbs' ;
2- import { Icon } from '@/components/icon' ;
3- import { Avatar , AvatarFallback , AvatarImage } from '@/components/ui/avatar' ;
4- import { Button } from '@/components/ui/button' ;
5- import { DropdownMenu , DropdownMenuContent , DropdownMenuTrigger } from '@/components/ui/dropdown-menu' ;
67import {
78 NavigationMenu ,
89 NavigationMenuItem ,
910 NavigationMenuLink ,
1011 NavigationMenuList ,
1112 navigationMenuTriggerStyle ,
12- } from '@/components/ui/navigation-menu' ;
13- import { Sheet , SheetContent , SheetHeader , SheetTitle , SheetTrigger } from '@/components/ui/sheet' ;
14- import { Tooltip , TooltipContent , TooltipProvider , TooltipTrigger } from '@/components/ui/tooltip' ;
15- import { UserMenuContent } from '@/components/user-menu-content' ;
13+ } from "@/components/ui/navigation-menu"
14+ import {
15+ DropdownMenu ,
16+ DropdownMenuContent ,
17+ DropdownMenuTrigger ,
18+ } from "@/components/ui/dropdown-menu"
19+ import {
20+ Tooltip ,
21+ TooltipContent ,
22+ TooltipProvider ,
23+ TooltipTrigger ,
24+ } from "@/components/ui/tooltip"
25+ import { type NavItem } from '@/types' ;
26+ import {
27+ Sheet ,
28+ SheetContent ,
29+ SheetHeader ,
30+ SheetTitle ,
31+ SheetTrigger ,
32+ } from "@/components/ui/sheet"
33+ import { type SharedData } from '@/types' ;
34+ import { Avatar , AvatarFallback , AvatarImage } from "@/components/ui/avatar"
35+ import { Menu , ChevronDown , FolderGit2 , BookOpenText , Search , LayoutGrid } from 'lucide-react'
1636import { useInitials } from '@/hooks/use-initials' ;
17- import { cn } from '@/lib/utils' ;
18- import { type BreadcrumbItem , type NavItem , type SharedData } from '@/types' ;
19- import { Link , usePage } from '@inertiajs/react' ;
20- import { BookOpenText , ChevronDown , FolderGit2 , LayoutGrid , Menu , Search } from 'lucide-react' ;
21- import AppLogo from './app-logo' ;
22- import AppLogoIcon from './app-logo-icon' ;
37+ import { cn } from "@/lib/utils" ;
38+ import { UserMenuContent } from '@/components/user-menu-content' ;
39+ import { Icon } from '@/components/icon' ;
2340
2441const mainNavItems : NavItem [ ] = [
2542 {
@@ -42,7 +59,7 @@ const rightNavItems: NavItem[] = [
4259 } ,
4360] ;
4461
45- const activeItemStyles = ' bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100' ;
62+ const activeItemStyles = " bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100" ;
4663
4764interface AppHeaderProps {
4865 breadcrumbs ?: BreadcrumbItem [ ] ;
@@ -53,128 +70,125 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
5370 const getInitials = useInitials ( ) ;
5471 return (
5572 < >
56- < div className = "border-b border-sidebar-border/80" >
57- < div className = "mx-auto flex h-16 items-center px-4 md:max-w-7xl" >
58- { /* Mobile Menu */ }
59- < div className = "lg:hidden" >
60- < Sheet >
61- < SheetTrigger asChild >
62- < Button variant = "ghost" size = "icon" className = "mr-2 h -[34px] w -[34px]" >
63- < Menu className = "h-5 w-5" />
64- </ Button >
65- </ SheetTrigger >
66- < SheetContent side = "left" className = "flex h-full w-64 flex-col items-stretch bg-neutral-50 " >
67- < SheetTitle className = "sr-only" > Navigation Menu</ SheetTitle >
68- < SheetHeader className = "flex justify-start text-left " >
69- < AppLogoIcon className = "h-6 w-6 fill-current text-black dark:text-white" />
70- </ SheetHeader >
71- < div className = "mt-6 flex h-full flex-1 flex-col space-y-4" >
72- < div className = "flex h-full flex-col justify-between text-sm" >
73- < div className = "flex flex-col space-y-4" >
74- { mainNavItems . map ( ( item ) => (
75- < Link key = { item . title } href = { item . url } className = "flex items-center space-x-2 font-medium" >
76- { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
77- < span > { item . title } </ span >
78- </ Link >
79- ) ) }
80- </ div >
73+ < div className = "border-b border-sidebar-border/80 " >
74+ < div className = "flex h-16 items-center px-4 md:max-w-7xl mx-auto " >
75+ { /* Mobile Menu */ }
76+ < div className = "lg:hidden" >
77+ < Sheet >
78+ < SheetTrigger asChild >
79+ < Button variant = "ghost" size = "icon" className = "mr-2 w -[34px] h -[34px]" >
80+ < Menu className = "h-5 w-5" />
81+ </ Button >
82+ </ SheetTrigger >
83+ < SheetContent side = "left" className = "bg-neutral-50 h-full flex flex-col items-stretch justify-between w-64 " >
84+ < SheetTitle className = "sr-only" > Navigation Menu</ SheetTitle >
85+ < SheetHeader className = "text-left flex justify-start" >
86+ < AppLogoIcon className = "h-6 w-6 fill-current text-black dark:text-white" />
87+ </ SheetHeader >
88+ < div className = "flex flex-col h-full space-y-4 mt-6 flex-1 " >
89+ < div className = "flex flex-col text-sm h-full justify-between " >
90+ < div className = "flex flex-col space-y-4" >
91+ { mainNavItems . map ( ( item ) => (
92+ < Link key = { item . title } href = { item . url } className = "flex items-center space-x-2 font-medium" >
93+ { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
94+ < span > { item . title } </ span >
95+ </ Link >
96+ ) ) }
97+ </ div >
8198
82- < div className = "flex flex-col space-y-4" >
83- { rightNavItems . map ( ( item ) => (
84- < a
85- key = { item . title }
86- href = { item . url }
87- target = "_blank"
88- rel = "noopener noreferrer"
89- className = "flex items-center space-x-2 font-medium"
90- >
91- { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
92- < span > { item . title } </ span >
93- </ a >
94- ) ) }
95- </ div >
99+ < div className = "flex flex-col space-y-4" >
100+ { rightNavItems . map ( ( item ) => (
101+ < a key = { item . title } href = { item . url } target = "_blank" rel = "noopener noreferrer" className = "flex items-center space-x-2 font-medium" >
102+ { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
103+ < span > { item . title } </ span >
104+ </ a >
105+ ) ) }
96106 </ div >
97107 </ div >
98- </ SheetContent >
99- </ Sheet >
100- </ div >
108+ </ div >
109+ </ SheetContent >
110+ </ Sheet >
111+ </ div >
101112
102- < Link href = "/dashboard" prefetch className = "flex items-center space-x-2" >
103- < AppLogo />
104- </ Link >
113+ < Link href = "/dashboard" prefetch className = "flex items-center space-x-2" >
114+ < AppLogo />
115+ </ Link >
105116
106- { /* Desktop Navigation */ }
107- < div className = "ml-6 hidden h-full items-center space-x-6 lg:flex" >
108- < NavigationMenu className = "flex h-full items-stretch" >
109- < NavigationMenuList className = "flex h-full items-stretch space-x-2" >
110- { mainNavItems . map ( ( item , index ) => (
111- < NavigationMenuItem key = { index } className = "relative flex h-full items-center" >
112- < Link href = { item . url } >
113- < NavigationMenuLink
114- className = { cn ( navigationMenuTriggerStyle ( ) , activeItemStyles , 'h-9 cursor-pointer px-3' ) }
115- >
116- { item . icon && < Icon iconNode = { item . icon } className = "mr-2 h-4 w-4" /> }
117- { item . title }
118- </ NavigationMenuLink >
119- </ Link >
120- < div className = "absolute bottom-0 left-0 h-0.5 w-full translate-y-px bg-black dark:bg-white" > </ div >
121- </ NavigationMenuItem >
122- ) ) }
123- </ NavigationMenuList >
124- </ NavigationMenu >
125- </ div >
117+ { /* Desktop Navigation */ }
118+ < div className = "hidden lg:flex items-center space-x-6 h-full ml-6" >
119+ < NavigationMenu className = "h-full flex items-stretch " >
120+ < NavigationMenuList className = "h-full space-x-2 flex items-stretch" >
126121
127- < div className = "ml-auto flex items-center space-x-2" >
128- < div className = "relative flex items-center space-x-1" >
129- < Button variant = "ghost" size = "icon" className = "h-9 w-9 cursor-pointer" >
130- < Search className = "h-5 w-5" />
131- </ Button >
132- < div className = "hidden space-x-1 lg:flex" >
133- { rightNavItems . map ( ( item ) => (
134- < TooltipProvider delayDuration = { 0 } >
135- < Tooltip >
136- < TooltipTrigger >
137- < Button key = { item . title } variant = "ghost" size = "icon" asChild className = "h-9 w-9 cursor-pointer" >
138- < a href = { item . url } target = "_blank" rel = "noopener noreferrer" >
139- < span className = "sr-only" > { item . title } </ span >
140- { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
141- </ a >
142- </ Button >
143- </ TooltipTrigger >
144- < TooltipContent >
145- < p > { item . title } </ p >
146- </ TooltipContent >
147- </ Tooltip >
148- </ TooltipProvider >
149- ) ) }
150- </ div >
122+ { mainNavItems . map ( ( item , index ) => (
123+ < NavigationMenuItem key = { index } className = "h-full flex items-center relative" >
124+ < Link href = { item . url } >
125+ < NavigationMenuLink className = { cn (
126+ navigationMenuTriggerStyle ( ) ,
127+ activeItemStyles ,
128+ "px-3 h-9 cursor-pointer"
129+ ) } >
130+ { item . icon && < Icon iconNode = { item . icon } className = "mr-2 h-4 w-4" /> }
131+ { item . title }
132+ </ NavigationMenuLink >
133+ </ Link >
134+ < div className = "h-0.5 translate-y-px bg-black dark:bg-white w-full absolute bottom-0 left-0" > </ div >
135+ </ NavigationMenuItem >
136+ ) ) }
137+ </ NavigationMenuList >
138+ </ NavigationMenu >
139+ </ div >
140+
141+ < div className = "ml-auto flex items-center space-x-2" >
142+ < div className = "relative flex items-center space-x-1" >
143+ < Button variant = "ghost" size = "icon" className = "w-9 h-9 cursor-pointer" >
144+ < Search className = "h-5 w-5" />
145+ </ Button >
146+ < div className = "hidden lg:flex space-x-1" >
147+ { rightNavItems . map ( ( item ) => (
148+ < TooltipProvider delayDuration = { 0 } >
149+ < Tooltip >
150+ < TooltipTrigger >
151+ < Button key = { item . title } variant = "ghost" size = "icon" asChild className = "w-9 h-9 cursor-pointer" >
152+ < a href = { item . url } target = "_blank" rel = "noopener noreferrer" >
153+ < span className = "sr-only" > { item . title } </ span >
154+ { item . icon && < Icon iconNode = { item . icon } className = "h-5 w-5" /> }
155+ </ a >
156+ </ Button >
157+ </ TooltipTrigger >
158+ < TooltipContent >
159+ < p > { item . title } </ p >
160+ </ TooltipContent >
161+ </ Tooltip >
162+ </ TooltipProvider >
163+ ) ) }
151164 </ div >
152- < DropdownMenu >
153- < DropdownMenuTrigger asChild >
154- < Button variant = "ghost" className = "h-9 px-1.5" >
155- < Avatar className = "h-7 w-7 overflow-hidden rounded-lg" >
156- < AvatarImage src = { auth . user . avatar } alt = { auth . user . name } />
157- < AvatarFallback className = "rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white" >
158- { getInitials ( auth . user . name ) }
159- </ AvatarFallback >
160- </ Avatar >
161- < ChevronDown className = "hidden h-4 w-4 lg:block" />
162- </ Button >
163- </ DropdownMenuTrigger >
164- < DropdownMenuContent className = "w-56" align = "end" >
165- < UserMenuContent user = { auth . user } />
166- </ DropdownMenuContent >
167- </ DropdownMenu >
168165 </ div >
166+ < DropdownMenu >
167+ < DropdownMenuTrigger asChild >
168+ < Button variant = "ghost" className = "h-9 px-1.5" >
169+ < Avatar className = "h-7 w-7 overflow-hidden rounded-lg" >
170+ < AvatarImage src = { auth . user . avatar } alt = { auth . user . name } />
171+ < AvatarFallback className = "rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white" >
172+ { getInitials ( auth . user . name ) }
173+ </ AvatarFallback >
174+ </ Avatar >
175+ < ChevronDown className = "h-4 w-4 hidden lg:block" />
176+ </ Button >
177+ </ DropdownMenuTrigger >
178+ < DropdownMenuContent className = "w-56" align = "end" >
179+ < UserMenuContent user = { auth . user } />
180+ </ DropdownMenuContent >
181+ </ DropdownMenu >
169182 </ div >
170183 </ div >
171- { breadcrumbs . length > 1 && (
172- < div className = "flex w-full border-b border-sidebar-border/70" >
173- < div className = "mx-auto flex h-12 w-full items-center justify-start px-4 text-neutral-500 md:max-w-7xl " >
174- < Breadcrumbs breadcrumbs = { breadcrumbs } / >
175- </ div >
184+ </ div >
185+ { breadcrumbs . length > 1 && (
186+ < div className = "w-full flex border-b border-sidebar-border/70 " >
187+ < div className = "flex h-12 items-center justify-start w-full px-4 md:max-w-7xl mx-auto text-neutral-500" >
188+ < Breadcrumbs breadcrumbs = { breadcrumbs } / >
176189 </ div >
177- ) }
178- </ >
179- ) ;
180- }
190+ </ div >
191+ ) }
192+ </ >
193+ )
194+ }
0 commit comments