Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3251268
D6358.id21281.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6358.id21281.diff
View Options
diff --git a/web/chat/chat-thread-list.css b/web/chat/chat-thread-list.css
--- a/web/chat/chat-thread-list.css
+++ b/web/chat/chat-thread-list.css
@@ -24,11 +24,7 @@
background: var(--thread-active-bg);
}
-.activeThread :is(div.dark, .lastMessage span.read, .title) {
- color: var(--chat-thread-list-color-active);
-}
-
-.activeThread .lastMessage.read {
+.activeThread :is(.title, .lastMessage, .lastMessage *) {
color: var(--chat-thread-list-color-active);
}
@@ -116,30 +112,26 @@
}
div.lastMessage {
- font-size: 16px;
+ font-size: var(--s-font-14);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: var(--line-height-text);
padding-bottom: 8px;
}
-div.threadRow > .lastMessage {
- color: var(--thread-last-message-color-read);
- font-size: var(--s-font-14);
-}
div.unread {
color: var(--fg);
font-weight: var(--semi-bold);
}
-div.lastMessage.unread {
- color: var(--fg);
-}
div.dark {
color: var(--thread-color-read);
padding-right: 16px;
}
-.read {
- color: var(--thread-from-color-read);
+.messagePreviewPrimary {
+ color: var(--thread-color-read);
+}
+.messagePreviewSecondary {
+ color: var(--thread-preview-secondary);
}
div.dotContainer {
display: flex;
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
@@ -1,6 +1,7 @@
// @flow
import classNames from 'classnames';
+import invariant from 'invariant';
import * as React from 'react';
import { getMessagePreview } from 'lib/shared/message-utils';
@@ -15,15 +16,9 @@
+threadInfo: ThreadInfo,
};
function MessagePreview(props: Props): React.Node {
- const {
- messageInfo: originalMessageInfo,
- threadInfo,
- threadInfo: {
- currentUser: { unread },
- },
- } = props;
+ const { messageInfo, threadInfo } = props;
- if (!originalMessageInfo) {
+ if (!messageInfo) {
return (
<div className={classNames(css.lastMessage, css.dark, css.italic)}>
No messages
@@ -32,19 +27,45 @@
}
const { message, username } = getMessagePreview(
- originalMessageInfo,
+ messageInfo,
threadInfo,
getDefaultTextMessageRules().simpleMarkdownRules,
);
let usernameText = null;
- const colorStyle = unread ? css.unread : css.read;
if (username) {
- usernameText = <span className={colorStyle}>{`${username.text}: `}</span>;
+ let usernameStyle;
+ if (username.style === 'unread') {
+ usernameStyle = css.unread;
+ } else if (username.style === 'secondary') {
+ usernameStyle = css.messagePreviewSecondary;
+ }
+ invariant(
+ usernameStyle,
+ `MessagePreview doesn't support ${username.style} style for username, ` +
+ 'only unread and secondary',
+ );
+ usernameText = (
+ <span className={usernameStyle}>{`${username.text}: `}</span>
+ );
}
+ let messageStyle;
+ if (message.style === 'unread') {
+ messageStyle = css.unread;
+ } else if (message.style === 'primary') {
+ messageStyle = css.messagePreviewPrimary;
+ } else if (message.style === 'secondary') {
+ messageStyle = css.messagePreviewSecondary;
+ }
+ invariant(
+ messageStyle,
+ `MessagePreview doesn't support ${message.style} style for message, ` +
+ 'only unread, primary, and secondary',
+ );
+
return (
- <div className={classNames(css.lastMessage, colorStyle)}>
+ <div className={classNames(css.lastMessage, messageStyle)}>
{usernameText}
{message.text}
</div>
diff --git a/web/theme.css b/web/theme.css
--- a/web/theme.css
+++ b/web/theme.css
@@ -95,8 +95,7 @@
--breadcrumb-color-unread: var(--shades-white-60);
--btn-outline-border: var(--shades-black-60);
--thread-color-read: var(--shades-black-60);
- --thread-from-color-read: var(--shades-black-80);
- --thread-last-message-color-read: var(--shades-black-60);
+ --thread-preview-secondary: var(--shades-black-80);
--relationship-button-green: var(--success-dark-50);
--relationship-button-red: var(--error-primary);
--relationship-button-text: var(--fg);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 5:23 PM (19 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2498161
Default Alt Text
D6358.id21281.diff (4 KB)
Attached To
Mode
D6358: [web] Use new style prop passed from getMessagePreview
Attached
Detach File
Event Timeline
Log In to Comment