From 706864c327d5ed5f6645ce33870e3babd826e408 Mon Sep 17 00:00:00 2001 From: yash Date: Thu, 7 Mar 2024 19:53:41 +0530 Subject: [PATCH] added noMessages_TextAndIcon --- .../src/components/MessageList/MessageList.js | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/react/src/components/MessageList/MessageList.js b/packages/react/src/components/MessageList/MessageList.js index 2cad03c4d..201387c56 100644 --- a/packages/react/src/components/MessageList/MessageList.js +++ b/packages/react/src/components/MessageList/MessageList.js @@ -7,8 +7,6 @@ import { useSearchMessageStore, useChannelStore, useUserStore, - useMentionsStore, - useThreadsMessageStore, } from '../../store'; import RoomMembers from '../RoomMembers/RoomMember'; import MessageReportWindow from '../ReportMessage/MessageReportWindow'; @@ -16,8 +14,10 @@ import isMessageSequential from '../../lib/isMessageSequential'; import SearchMessage from '../SearchMessage/SearchMessage'; import Roominfo from '../RoomInformation/RoomInformation'; import AllThreads from '../AllThreads/AllThreads'; -import UserMentions from '../UserMentions/UserMentions'; import { Message } from '../Message'; +import { Icon } from '../Icon'; + +import useThreadsMessageStore from '../../store/threadsMessageStore'; const MessageList = ({ messages }) => { const showSearch = useSearchMessageStore((state) => state.showSearch); @@ -27,14 +27,29 @@ const MessageList = ({ messages }) => { const showReportMessage = useMessageStore((state) => state.showReportMessage); const messageToReport = useMessageStore((state) => state.messageToReport); const showAvatar = useUserStore((state) => state.showAvatar); + const headerTitle = useMessageStore((state) => state.headerTitle); const showAllThreads = useThreadsMessageStore( (state) => state.showAllThreads ); - const showMentions = useMentionsStore((state) => state.showMentions); const isMessageNewDay = (current, previous) => !previous || !isSameDay(new Date(current.ts), new Date(previous.ts)); - + let iconType = 'thread'; + if (headerTitle === 'Pinned Messages') { + iconType = 'pin'; + } else if (headerTitle === 'Starred Messages') { + iconType = 'star'; + } + if (messages.length === 0) { + return ( +
+
+ +
+
No {headerTitle}
+
+ ); + } return ( <> {messages && @@ -61,7 +76,6 @@ const MessageList = ({ messages }) => { {showSearch && } {showChannelinfo && } {showAllThreads && } - {showMentions && } ); };