From e3cb12614543360854c93331e860e4e9a29e1793 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 2 May 2023 17:52:53 +0400 Subject: [PATCH] Chat List: Close Forum Panel on forum avatar click --- src/components/left/main/Chat.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/left/main/Chat.tsx b/src/components/left/main/Chat.tsx index 33300f1ea..444d8fe90 100644 --- a/src/components/left/main/Chat.tsx +++ b/src/components/left/main/Chat.tsx @@ -125,6 +125,7 @@ const Chat: FC = ({ focusLastMessage, loadTopics, openForumPanel, + closeForumPanel, } = getActions(); const { isMobile } = useAppLayout(); @@ -156,7 +157,12 @@ const Chat: FC = ({ const handleClick = useCallback(() => { if (isForum) { - openForumPanel({ chatId }, { forceOnHeavyAnimation: true }); + if (isSelectedForum) { + closeForumPanel(undefined, { forceOnHeavyAnimation: true }); + } else { + openForumPanel({ chatId }, { forceOnHeavyAnimation: true }); + } + return; } @@ -165,7 +171,7 @@ const Chat: FC = ({ if (isSelected && canScrollDown) { focusLastMessage(); } - }, [isForum, openChat, chatId, isSelected, canScrollDown, openForumPanel, focusLastMessage]); + }, [isForum, chatId, isSelected, canScrollDown, isSelectedForum]); const handleDragEnter = useCallback((e) => { e.preventDefault();