@@ -71,22 +71,14 @@ export function Chat({ repo, path, setPath, graph, chartRef, selectedPathId, isP
7171 const [ isPathResponse , setIsPathResponse ] = useState ( false ) ;
7272
7373 const [ tipOpen , setTipOpen ] = useState ( false ) ;
74-
74+
7575 const [ sugOpen , setSugOpen ] = useState ( false ) ;
7676
7777 // A reference to the chat container to allow scrolling to the bottom
7878 const containerRef : React . RefObject < HTMLDivElement > = useRef ( null ) ;
7979
80- const tipRef : React . RefObject < HTMLDivElement > = useRef ( null ) ;
81-
8280 const isSendMessage = messages . some ( m => m . type === MessageTypes . Pending ) || ( messages . some ( m => m . text === "Please select a starting point and the end point. Select or press relevant item on the graph" ) && ! messages . some ( m => m . type === MessageTypes . Path ) )
8381
84- useEffect ( ( ) => {
85- if ( tipOpen ) {
86- tipRef . current ?. focus ( )
87- }
88- } , [ tipOpen ] )
89-
9082 useEffect ( ( ) => {
9183 const p = paths . find ( ( path ) => [ ...path . edges , ...path . nodes ] . some ( ( e : any ) => e . id === selectedPathId ) )
9284
@@ -499,7 +491,7 @@ export function Chat({ repo, path, setPath, graph, chartRef, selectedPathId, isP
499491 }
500492 {
501493 tipOpen &&
502- < div ref = { tipRef } className = "bg-white fixed bottom-[85px] border rounded-md flex flex-col gap-3 p-2 overflow-y-auto" onBlur = { ( ) => setTipOpen ( false ) } >
494+ < div ref = { ref => ref ?. focus ( ) } className = "bg-white absolute bottom-0 border rounded-md flex flex-col gap-3 p-2 overflow-y-auto" tabIndex = { - 1 } onMouseDown = { ( e ) => e . preventDefault ( ) } onBlur = { ( ) => setTipOpen ( false ) } >
503495 { getTip ( ) }
504496 </ div >
505497 }
@@ -509,7 +501,7 @@ export function Chat({ repo, path, setPath, graph, chartRef, selectedPathId, isP
509501 {
510502 repo &&
511503 < div className = "flex gap-4 px-4" >
512- < button disabled = { isSendMessage } className = "p-4 border rounded-md hover:border-[#FF66B3] hover:bg-[#FFF0F7]" >
504+ < button onClick = { ( ) => setTipOpen ( prev => ! prev ) } disabled = { isSendMessage } className = "p-4 border rounded-md hover:border-[#FF66B3] hover:bg-[#FFF0F7]" >
513505 < Lightbulb />
514506 </ button >
515507 < form className = "grow flex items-center border rounded-md px-2" onSubmit = { sendQuery } >
0 commit comments