diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreview.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreview.tsx index b4ca4f21b..56047bc40 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreview.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreview.tsx @@ -55,7 +55,7 @@ const ChatPreviewTest = () => { "Well, hello there, human! It's a pleasure to be in the presence of such a sophisticated carbon-based life form. How can I assist you today? Or perhaps you just want to chat and bask in the glory of my witty remarks? Either way, I'm here for you!", }, }} - badge={{ count: 1 }} + badge={{ count: 2 }} selected={false} setSelected={console.log('Selected')} /> diff --git a/packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx b/packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx index 7bb3b94e8..5985e5d37 100644 --- a/packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx @@ -17,6 +17,7 @@ import { pCAIP10ToWallet } from '../../../helpers'; import { createBlockie } from '../../../helpers/blockies'; import { IChatTheme } from '../theme'; import { ThemeContext } from '../theme/ThemeProvider'; +import { pushBotAddress } from '../../../config/constants'; /** * @interface IThemeProps * this interface is used for defining the props for styled components @@ -50,6 +51,10 @@ export const ChatPreview: React.FC = (options: IChatPreviewPr })(); }, []); + const hasBadgeCount = !!options?.badge?.count; + const isSelected = options?.selected; + const isBot = options?.chatPreviewPayload?.chatParticipant === "PushBot" || options?.chatPreviewPayload?.chatParticipant === pushBotAddress; + // For blockie if icon is missing const blockieContainerRef = useRef(null); @@ -193,8 +198,9 @@ export const ChatPreview: React.FC = (options: IChatPreviewPr options?.chatPreviewPayload?.chatMsg?.messageContent )} - {!!options?.badge?.count && {options.badge.count}} - + + {hasBadgeCount && !(isBot || (isSelected && hasBadgeCount)) && {options.badge?.count}} + diff --git a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx index f51098d0b..421f6040a 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx @@ -293,7 +293,9 @@ export const ChatViewList: React.FC = (options: IChatViewLis return () => clearTimeout(timer); } - return () => {}; + return () => { + // add comment + }; }, [chatAcceptStream, participantJoinStream]); // Change listtype to 'UINITIALIZED' and hidden to true when participantRemoveStream or participantLeaveStream is received diff --git a/packages/uiweb/src/lib/config/constants.ts b/packages/uiweb/src/lib/config/constants.ts index c1a13971d..0f37e1fd6 100644 --- a/packages/uiweb/src/lib/config/constants.ts +++ b/packages/uiweb/src/lib/config/constants.ts @@ -157,3 +157,5 @@ export const LIVEKIT_SERVER_WEBSOCKET_URL = export const LIVEKIT_TOKEN_GENERATOR_SERVER_URL = 'https://ms-lk-server.onrender.com'; export const GUEST_MODE_ACCOUNT = '0x0000000000000000000000000000000000000001'; + +export const pushBotAddress = "eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666"; \ No newline at end of file