Skip to content

Commit f48c363

Browse files
fix: fixed the blurr issue in chat on join and accept group
1 parent 8d360bc commit f48c363

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,16 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
144144

145145
// Change listtype to 'CHATS' and hidden to false when chatAcceptStream is received
146146
useEffect(() => {
147-
if (Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) {
147+
if (
148+
(Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) ||
149+
(Object.keys(participantJoinStream || {}).length > 0 && participantJoinStream.constructor === Object)
150+
) {
148151
// Always change hidden to false and list will be CHATS
149152
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
150-
if (updatedChatInfo) updatedChatInfo.list = 'CHATS';
153+
if (updatedChatInfo) {
154+
updatedChatInfo.list = 'CHATS';
155+
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = true;
156+
}
151157

152158
// set initialized after chat accept animation is done
153159
const timer = setTimeout(() => {
@@ -160,10 +166,16 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
160166

161167
// Change listtype to 'UINITIALIZED' and hidden to true when participantRemoveStream or participantLeaveStream is received
162168
useEffect(() => {
163-
if (Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) {
169+
if (
170+
(Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) ||
171+
(Object.keys(participantLeaveStream || {}).length > 0 && participantLeaveStream.constructor === Object)
172+
) {
164173
// If not encrypted, then set hidden to false
165174
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
166-
if (updatedChatInfo) updatedChatInfo.list = 'UNINITIALIZED';
175+
if (updatedChatInfo) {
176+
updatedChatInfo.list = 'UNINITIALIZED';
177+
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = false;
178+
}
167179

168180
setInitialized({ ...initialized, chatInfo: updatedChatInfo, isHidden: true });
169181
}
@@ -357,7 +369,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
357369
flexDirection="column"
358370
justifyContent="start"
359371
width="100%"
360-
blur={initialized.isHidden}
372+
blur={initialized.isHidden && initialized?.chatInfo?.list !== 'REQUESTS'}
361373
>
362374
{messages &&
363375
messages?.map((chat: IMessageIPFS, index: number) => {

0 commit comments

Comments
 (0)