Chat List: Close Forum Panel on forum avatar click

This commit is contained in:
Alexander Zinchuk 2023-05-02 17:52:53 +04:00
parent 478125d0db
commit e3cb126145

View File

@ -125,6 +125,7 @@ const Chat: FC<OwnProps & StateProps> = ({
focusLastMessage, focusLastMessage,
loadTopics, loadTopics,
openForumPanel, openForumPanel,
closeForumPanel,
} = getActions(); } = getActions();
const { isMobile } = useAppLayout(); const { isMobile } = useAppLayout();
@ -156,7 +157,12 @@ const Chat: FC<OwnProps & StateProps> = ({
const handleClick = useCallback(() => { const handleClick = useCallback(() => {
if (isForum) { if (isForum) {
openForumPanel({ chatId }, { forceOnHeavyAnimation: true }); if (isSelectedForum) {
closeForumPanel(undefined, { forceOnHeavyAnimation: true });
} else {
openForumPanel({ chatId }, { forceOnHeavyAnimation: true });
}
return; return;
} }
@ -165,7 +171,7 @@ const Chat: FC<OwnProps & StateProps> = ({
if (isSelected && canScrollDown) { if (isSelected && canScrollDown) {
focusLastMessage(); focusLastMessage();
} }
}, [isForum, openChat, chatId, isSelected, canScrollDown, openForumPanel, focusLastMessage]); }, [isForum, chatId, isSelected, canScrollDown, isSelectedForum]);
const handleDragEnter = useCallback((e) => { const handleDragEnter = useCallback((e) => {
e.preventDefault(); e.preventDefault();