@@ -4,12 +4,24 @@ import { useTrip } from '../context/TripContext';
44import { useAuth } from '../context/authContext' ;
55
66export default function MobileNav ( ) {
7- const { activePanel, setActivePanel, optimizedRoute, isSidebarOpen, setIsSidebarOpen, isChatOpen, setIsChatOpen } = useTrip ( ) ;
7+ const {
8+ activePanel,
9+ setActivePanel,
10+ optimizedRoute,
11+ isSidebarOpen,
12+ setIsSidebarOpen,
13+ isChatOpen,
14+ setIsChatOpen,
15+ chatHeight,
16+ sidebarHeight,
17+ routeHeight
18+ } = useTrip ( ) ;
819 const { userLoggedIn, openLoginModal, currentUser, openSavedTripsModal } = useAuth ( ) ;
920
10- const handleTabClick = ( panel ) => {
11-
21+ // Compact nav whenever any panel is open
22+ const isFullPanelOpen = activePanel !== 'none' ;
1223
24+ const handleTabClick = ( panel ) => {
1325 // Toggle panel off if already active, otherwise switch to it
1426 if ( activePanel === panel ) {
1527 setActivePanel ( 'none' ) ;
@@ -54,40 +66,40 @@ export default function MobileNav() {
5466 } ;
5567
5668 return (
57- < nav className = " md:hidden fixed bottom-0 left-0 right-0 z-50 pb-4 pt-2 px-3 flex items-center gap-3 bg-gradient-to-t from-white via-white to-transparent" >
69+ < nav className = { ` md:hidden fixed bottom-0 left-0 right-0 z-50 px-3 flex items-center gap-2 bg-gradient-to-t from-white via-white to-transparent transition-all duration-300 ${ isFullPanelOpen ? 'pb-2 pt-1' : 'pb-4 pt-2 gap-3' } ` } >
5870 { /* Floating Profile Button */ }
5971 < button
6072 onClick = { handleProfileClick }
61- className = { `w-12 h-12 rounded-full shadow-lg flex items-center justify-center text-white text-sm font-medium transition-all duration-200 hover:scale-105 shrink-0 ${ userLoggedIn ? 'bg-gradient-to-br from-blue-500 to-blue-700' : 'bg-gray-400' } ` }
73+ className = { `rounded-full shadow-lg flex items-center justify-center text-white font-medium transition-all duration-300 hover:scale-105 shrink-0 ${ userLoggedIn ? 'bg-gradient-to-br from-blue-500 to-blue-700' : 'bg-gray-400' } ${ isFullPanelOpen ? 'w-9 h-9 text-xs' : 'w-12 h-12 text-sm '} ` }
6274 aria-label = "Profile"
6375 >
6476 { getInitials ( ) }
6577 </ button >
6678
6779 { /* Tab Group - fills remaining space */ }
68- < div className = " flex flex-1 bg-white rounded-2xl shadow-lg overflow-hidden" >
80+ < div className = { ` flex flex-1 bg-white shadow-lg overflow-hidden transition-all duration-300 ${ isFullPanelOpen ? 'rounded-xl' : 'rounded-2xl' } ` } >
6981 { /* Itinerary Tab */ }
7082 < button
7183 onClick = { ( ) => handleTabClick ( 'itinerary' ) }
72- className = { `flex-1 flex flex-col items-center justify-center py-3 transition-colors ${ activePanel === 'itinerary'
84+ className = { `flex-1 flex items-center justify-center gap-1.5 transition-all duration-300 ${ isFullPanelOpen ? ' py-2' : 'py-3 flex-col gap-0' } ${ activePanel === 'itinerary'
7385 ? 'text-blue-600 bg-blue-50'
7486 : 'text-gray-500'
7587 } `}
7688 aria-label = "View itinerary"
7789 >
78- < svg className = "w- 5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
90+ < svg className = { `transition-all duration-300 ${ isFullPanelOpen ? 'w-4 h-4' : 'w- 5 h-5' } ` } fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
7991 < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" />
8092 </ svg >
81- < span className = " text-[10px] mt-0.5 font-medium" > Trip</ span >
93+ < span className = { `font-medium transition-all duration-300 ${ isFullPanelOpen ? ' text-xs' : 'text- [10px] mt-0.5' } ` } > Trip</ span >
8294 </ button >
8395
8496 { /* Divider */ }
85- < div className = " w-px bg-gray-200 my-2" > </ div >
97+ < div className = { ` w-px bg-gray-200 transition-all duration-300 ${ isFullPanelOpen ? ' my-2' : 'my-2' } ` } > </ div >
8698
8799 { /* Route Tab */ }
88100 < button
89101 onClick = { ( ) => handleTabClick ( 'route' ) }
90- className = { `flex-1 flex flex-col items-center justify-center py-3 transition-colors ${ activePanel === 'route'
102+ className = { `flex-1 flex items-center justify-center gap-1.5 transition-all duration-300 ${ isFullPanelOpen ? ' py-2' : 'py-3 flex-col gap-0' } ${ activePanel === 'route'
91103 ? 'text-blue-600 bg-blue-50'
92104 : optimizedRoute
93105 ? 'text-gray-500'
@@ -96,28 +108,28 @@ export default function MobileNav() {
96108 aria-label = "View optimized route"
97109 disabled = { ! optimizedRoute }
98110 >
99- < svg className = "w- 5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
111+ < svg className = { `transition-all duration-300 ${ isFullPanelOpen ? 'w-4 h-4' : 'w- 5 h-5' } ` } fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
100112 < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7" />
101113 </ svg >
102- < span className = " text-[10px] mt-0.5 font-medium" > Route</ span >
114+ < span className = { `font-medium transition-all duration-300 ${ isFullPanelOpen ? ' text-xs' : 'text- [10px] mt-0.5' } ` } > Route</ span >
103115 </ button >
104116
105117 { /* Divider */ }
106- < div className = " w-px bg-gray-200 my-2" > </ div >
118+ < div className = { ` w-px bg-gray-200 transition-all duration-300 ${ isFullPanelOpen ? ' my-2' : 'my-2' } ` } > </ div >
107119
108120 { /* AI Chat Tab */ }
109121 < button
110122 onClick = { ( ) => handleTabClick ( 'chat' ) }
111- className = { `flex-1 flex flex-col items-center justify-center py-3 transition-colors ${ activePanel === 'chat'
123+ className = { `flex-1 flex items-center justify-center gap-1.5 transition-all duration-300 ${ isFullPanelOpen ? ' py-2' : 'py-3 flex-col gap-0' } ${ activePanel === 'chat'
112124 ? 'text-blue-600 bg-blue-50'
113125 : 'text-gray-500'
114126 } `}
115127 aria-label = "Open AI assistant"
116128 >
117- < svg className = "w- 5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
129+ < svg className = { `transition-all duration-300 ${ isFullPanelOpen ? 'w-4 h-4' : 'w- 5 h-5' } ` } fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
118130 < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
119131 </ svg >
120- < span className = " text-[10px] mt-0.5 font-medium" > AI</ span >
132+ < span className = { `font-medium transition-all duration-300 ${ isFullPanelOpen ? ' text-xs' : 'text- [10px] mt-0.5' } ` } > AI</ span >
121133 </ button >
122134 </ div >
123135 </ nav >
0 commit comments