Skip to content

Commit 3aecebc

Browse files
committed
fix
1 parent da92572 commit 3aecebc

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

app/components/Input.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ export default function Input({ value, onValueChange, handelSubmit, graph, icon,
163163
selectedOption === index && "bg-gray-100"
164164
)}
165165
onMouseEnter={() => setSelectedOption(index)}
166-
onMouseLeave={() => setSelectedOption(-1)}
167166
onClick={() => {
168167
onValueChange({ name: option.properties.name, id: option.id })
169168
handelSubmit && handelSubmit(option)

app/components/chat.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)