Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added no pinned messages and no starred messages text in the message list component. #500

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions packages/react/src/components/MessageList/MessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import {
import RoomMembers from '../RoomMembers/RoomMember';
import MessageReportWindow from '../ReportMessage/MessageReportWindow';
import isMessageSequential from '../../lib/isMessageSequential';
import UserMentions from '../UserMentions/UserMentions';
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';

const MessageList = ({ messages }) => {
const showSearch = useSearchMessageStore((state) => state.showSearch);
Expand All @@ -27,14 +28,33 @@ 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 showMentions = useMentionsStore((state) => state.showMentions);
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';
let msgType = headerTitle;
if (msgType === 'Pinned Messages') {
iconType = 'pin';
} else if (msgType === 'Starred Messages') {
iconType = 'star';
} else {
msgType = 'messages';
}
if (messages.length === 0) {
return (
<div style={{ margin: 'auto' }}>
<div style={{ textAlign: 'center' }}>
<Icon name={iconType} size="2rem" />
</div>
<div style={{ textAlign: 'center' }}>No {msgType}</div>
</div>
);
}
return (
<>
{messages &&
Expand Down
Loading