mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Close the agent detail hover card when scroll on agent pane
This commit is contained in:
parent
110c67f083
commit
91bbd19333
1 changed files with 14 additions and 0 deletions
|
@ -169,6 +169,20 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
|||
}
|
||||
}, [selectedAgent, message, processingMessage, onConversationIdChange]);
|
||||
|
||||
// Close the agent detail hover card when scroll on agent pane
|
||||
useEffect(() => {
|
||||
const scrollAreaSelector = "[data-radix-scroll-area-viewport]";
|
||||
const scrollAreaEl = document.querySelector<HTMLElement>(scrollAreaSelector);
|
||||
const handleScroll = () => {
|
||||
setHoveredAgent(null);
|
||||
setIsPopoverOpen(false);
|
||||
};
|
||||
|
||||
scrollAreaEl?.addEventListener("scroll", handleScroll);
|
||||
|
||||
return () => scrollAreaEl?.removeEventListener("scroll", handleScroll);
|
||||
}, []);
|
||||
|
||||
function fillArea(link: string, type: string, prompt: string) {
|
||||
if (!link) {
|
||||
let message_str = "";
|
||||
|
|
Loading…
Reference in a new issue