From b2950435a14b40b8c4e06ddd32b3ac44d35a48ab Mon Sep 17 00:00:00 2001 From: Monalisha Mishra <42746736+mishramonalisha76@users.noreply.github.com> Date: Wed, 29 May 2024 23:15:00 +0530 Subject: [PATCH] fix: fixed the blurr issue in chat on join and accept group (#1305) --- .../chat/ChatViewList/ChatViewList.tsx | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx index 2ecbd0e52..4d7dd349b 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx @@ -280,10 +280,16 @@ export const ChatViewList: React.FC = (options: IChatViewLis // Change listtype to 'CHATS' and hidden to false when chatAcceptStream is received useEffect(() => { - if (Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) { + if ( + (Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) || + (Object.keys(participantJoinStream || {}).length > 0 && participantJoinStream.constructor === Object) + ) { // Always change hidden to false and list will be CHATS const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) }; - if (updatedChatInfo) updatedChatInfo.list = 'CHATS'; + if (updatedChatInfo) { + updatedChatInfo.list = 'CHATS'; + if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = true; + } // set initialized after chat accept animation is done const timer = setTimeout(() => { @@ -300,10 +306,16 @@ export const ChatViewList: React.FC = (options: IChatViewLis // Change listtype to 'UINITIALIZED' and hidden to true when participantRemoveStream or participantLeaveStream is received useEffect(() => { - if (Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) { + if ( + (Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) || + (Object.keys(participantLeaveStream || {}).length > 0 && participantLeaveStream.constructor === Object) + ) { // If not encrypted, then set hidden to false const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) }; - if (updatedChatInfo) updatedChatInfo.list = 'UNINITIALIZED'; + if (updatedChatInfo) { + updatedChatInfo.list = 'UNINITIALIZED'; + if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = false; + } setInitialized({ ...initialized, chatInfo: updatedChatInfo, isHidden: true }); } @@ -515,8 +527,9 @@ export const ChatViewList: React.FC = (options: IChatViewLis flexDirection="column" justifyContent="start" width="100%" - ref={chatContainerRef} - blur={initialized.isHidden} + ref={chatContainerRef} + blur={initialized.isHidden && initialized?.chatInfo?.list !== 'REQUESTS'} + > {messages && messages?.map((chat: IMessageIPFS, index: number) => {