@@ -38,6 +38,7 @@ export default function Sidebar() {
3838 // Desktop tab: 'itinerary' | 'route'
3939 const [ desktopTab , setDesktopTab ] = useState ( 'itinerary' ) ;
4040 const [ isSaving , setIsSaving ] = useState ( false ) ;
41+ const [ showSignInPrompt , setShowSignInPrompt ] = useState ( false ) ;
4142
4243 // Draggable panel hook
4344 const { panelRef, handleDragStart } = useDraggablePanel ( {
@@ -55,8 +56,11 @@ export default function Sidebar() {
5556 useEffect ( ( ) => {
5657 if ( optimizedRoute ) {
5758 setDesktopTab ( 'route' ) ;
59+ if ( ! currentUser ) {
60+ setShowSignInPrompt ( true ) ;
61+ }
5862 }
59- } , [ optimizedRoute ] ) ;
63+ } , [ optimizedRoute , currentUser ] ) ;
6064
6165 const handleDragEnd = ( result ) => {
6266 if ( ! result . destination ) return ;
@@ -299,31 +303,60 @@ export default function Sidebar() {
299303 ) : (
300304 /* Route tab actions */
301305 optimizedRoute && (
302- < div className = "p-4 border-t bg-gray-50 rounded-b-lg flex gap-2" >
303- < button
304- onClick = { handleSaveTrip }
305- disabled = { isSaving }
306- className = { `flex-1 py-2.5 px-4 bg-green-600 text-white rounded-lg font-medium flex items-center justify-center gap-2 hover:bg-green-700 transition-colors ${ isSaving ? 'opacity-75 cursor-not-allowed' : ''
307- } `}
308- >
309- { isSaving ? (
310- < div className = "w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin" > </ div >
311- ) : (
306+ < div className = "p-4 border-t bg-gray-50 rounded-b-lg flex flex-col gap-2" >
307+ { showSignInPrompt && ! currentUser && (
308+ < div className = "mb-2 p-3 bg-blue-50 border border-blue-100 rounded-lg flex justify-between items-center shadow-sm animate-slide-up" >
309+ < div className = "flex-1" >
310+ < p className = "text-sm text-blue-800 font-medium" > ✨ Trip optimized!</ p >
311+ < p className = "text-xs text-blue-600 mt-0.5" > Sign in to save this trip.</ p >
312+ </ div >
313+ < div className = "flex gap-2 ml-3" >
314+ < button
315+ onClick = { ( ) => setShowSignInPrompt ( false ) }
316+ className = "text-blue-400 hover:text-blue-600 p-1"
317+ >
318+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
319+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" />
320+ </ svg >
321+ </ button >
322+ < button
323+ onClick = { ( ) => {
324+ openLoginModal ( ) ;
325+ setShowSignInPrompt ( false ) ;
326+ } }
327+ className = "px-3 py-1.5 bg-blue-600 text-white text-xs font-semibold rounded-md hover:bg-blue-700 transition-colors whitespace-nowrap"
328+ >
329+ Sign In
330+ </ button >
331+ </ div >
332+ </ div >
333+ ) }
334+ < div className = "flex gap-2" >
335+ < button
336+ onClick = { handleSaveTrip }
337+ disabled = { isSaving }
338+ className = { `flex-1 py-2.5 px-4 bg-green-600 text-white rounded-lg font-medium flex items-center justify-center gap-2 hover:bg-green-700 transition-colors ${ isSaving ? 'opacity-75 cursor-not-allowed' : ''
339+ } `}
340+ >
341+ { isSaving ? (
342+ < div className = "w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin" > </ div >
343+ ) : (
344+ < svg className = "w-5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
345+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" />
346+ </ svg >
347+ ) }
348+ Save
349+ </ button >
350+ < button
351+ onClick = { exportToGoogleMaps }
352+ className = "flex-1 py-2.5 px-4 bg-blue-600 text-white rounded-lg font-medium flex items-center justify-center gap-2 hover:bg-blue-700 transition-colors"
353+ >
312354 < svg className = "w-5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
313- < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4 " />
355+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14 " />
314356 </ svg >
315- ) }
316- Save
317- </ button >
318- < button
319- onClick = { exportToGoogleMaps }
320- className = "flex-1 py-2.5 px-4 bg-blue-600 text-white rounded-lg font-medium flex items-center justify-center gap-2 hover:bg-blue-700 transition-colors"
321- >
322- < svg className = "w-5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
323- < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
324- </ svg >
325- Export
326- </ button >
357+ Export
358+ </ button >
359+ </ div >
327360 </ div >
328361 )
329362 ) }
0 commit comments