Show agent details card on hover on agent pill on web app home page

- Double click on agent to open edit agent card
- Focus on chat input pane when agent selected/clicked
  for quick, smooth agent switch and message flow
- Hover on agent to see agent detail card on non-mobile displays
  - Use debounce to only show when hover on card for a bit
This commit is contained in:
Debanjum Singh Solanky
2024-10-20 20:34:12 -07:00
parent 220ff1df62
commit 9b554feb91
2 changed files with 110 additions and 21 deletions

View File

@@ -70,3 +70,19 @@ export function useIsMobileWidth() {
return isMobileWidth;
}
export function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value);
useEffect(() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
return () => {
clearTimeout(handler);
};
}, [value, delay]);
return debouncedValue;
}