diff --git a/src/ui_kit/FloatingSupportChat/Chat.tsx b/src/ui_kit/FloatingSupportChat/Chat.tsx index 4cb5d424..a8b60615 100644 --- a/src/ui_kit/FloatingSupportChat/Chat.tsx +++ b/src/ui_kit/FloatingSupportChat/Chat.tsx @@ -4,7 +4,6 @@ import { IconButton, InputAdornment, InputBase, - InputLabel, SxProps, Theme, Typography, @@ -21,8 +20,7 @@ import ChatMessage from "./ChatMessage"; import ChatVideo from "./ChatVideo"; import SendIcon from "@icons/SendIcon"; import UserCircleIcon from "./UserCircleIcon"; -import { throttle, getAuthToken } from "@frontend/kitui"; -import { useEventListener } from "@frontend/kitui"; +import { throttle } from "@frontend/kitui"; import ArrowLeft from "@icons/questionsPage/arrowLeft"; import { useUserStore } from "@root/user"; import AttachFileIcon from "@mui/icons-material/AttachFile"; @@ -35,6 +33,8 @@ import { } from "@utils/checkAcceptableMediaType"; import { enqueueSnackbar } from "notistack"; +import type { WheelEvent, TouchEvent } from "react"; + interface Props { open: boolean; sx?: SxProps; @@ -110,7 +110,6 @@ export default function Chat({ }, 200), [fetchState], ); - useEventListener("scroll", throttledScrollHandler, chatBoxRef); useEffect(() => { if (chatBoxRef.current && chatBoxRef.current.scrollTop < 1) @@ -128,6 +127,15 @@ export default function Chat({ }, [lastMessageId], ); + + const loadNewMessages = ( + event: WheelEvent | TouchEvent, + ) => { + event.stopPropagation(); + + throttledScrollHandler(); + }; + function scrollToBottom(behavior?: ScrollBehavior) { if (!chatBoxRef.current) return; @@ -209,6 +217,8 @@ export default function Chat({ }} >