diff --git a/web/chat/message-preview.react.js b/web/chat/message-preview.react.js --- a/web/chat/message-preview.react.js +++ b/web/chat/message-preview.react.js @@ -22,16 +22,18 @@ +threadInfo: ThreadInfo, }; function MessagePreview(props: Props): React.Node { + const previewCls = classNames(css.lastMessage, css.dark); + const unread = props.threadInfo.currentUser.unread; + const colorStyle = unread ? css.black : css.dark; + const lastMsgCls = classNames(css.lastMessage, colorStyle); + if (!props.messageInfo) { - return ( -
No messages
- ); + return
No messages
; } const messageInfo: ComposableMessageInfo | RobotextMessageInfo = props.messageInfo.type === messageTypes.SIDEBAR_SOURCE ? props.messageInfo.sourceMessage : props.messageInfo; - const unread = props.threadInfo.currentUser.unread; const messageTitle = getMessageTitle( messageInfo, props.threadInfo, @@ -49,20 +51,14 @@ const usernameStyle = unread ? css.black : css.light; usernameText = {username}; } - const colorStyle = unread ? css.black : css.dark; return ( -
+
{usernameText} {messageTitle}
); } else { - const colorStyle = unread ? css.black : css.light; - return ( -
- {messageTitle} -
- ); + return
{messageTitle}
; } }