Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3365269
D4924.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D4924.diff
View Options
diff --git a/web/chat/chat-message-list.css b/web/chat/chat-message-list.css
--- a/web/chat/chat-message-list.css
+++ b/web/chat/chat-message-list.css
@@ -206,7 +206,7 @@
grid-column-end: span 2;
}
div.sidebarMarginBottom {
- margin-bottom: 8px;
+ margin-bottom: 2px;
}
svg.inlineSidebarIcon {
color: #666666;
diff --git a/web/chat/composed-message.react.js b/web/chat/composed-message.react.js
--- a/web/chat/composed-message.react.js
+++ b/web/chat/composed-message.react.js
@@ -16,7 +16,7 @@
import { type InputState, InputStateContext } from '../input/input-state';
import css from './chat-message-list.css';
import FailedSend from './failed-send.react';
-import { InlineSidebar } from './inline-sidebar.react';
+import InlineSidebar from './inline-sidebar.react';
import { tooltipPositions, useMessageTooltip } from './tooltip-utils';
const availableTooltipPositionsForViewerMessage = [
diff --git a/web/chat/inline-sidebar.css b/web/chat/inline-sidebar.css
--- a/web/chat/inline-sidebar.css
+++ b/web/chat/inline-sidebar.css
@@ -1,33 +1,55 @@
+div.inlineSidebarContainer {
+ display: flex;
+}
+div.centerContainer {
+ justify-content: center;
+}
+div.leftContainer {
+ justify-content: flex-start;
+ position: relative;
+ top: -10px;
+ left: 12px;
+}
+div.rightContainer {
+ justify-content: flex-end;
+ position: relative;
+ top: -10px;
+ right: 31px;
+}
div.inlineSidebarContent {
+ background: var(--inline-sidebar-bg);
+ color: var(--inline-sidebar-color);
+ font-size: var(--s-font-14);
+ line-height: var(--line-height-text);
flex-direction: row;
display: flex;
- margin: 0 40px 0 20px;
+ border-radius: 16px;
+ padding: 8px;
cursor: pointer;
+ gap: 12px;
+ align-items: center;
+ transition: background 0.2s ease-in-out;
+}
+
+div.inlineSidebarContent:hover {
+ background: var(--inline-sidebar-bg-hover);
}
-div.inlineSidebar {
+
+div.reactionsContainer {
flex-direction: row;
display: flex;
- align-items: center;
+ gap: 4px;
}
-div.inlineSidebarName {
- padding-top: 1px;
- color: #666666;
- font-size: 16px;
- padding-left: 4px;
- padding-right: 2px;
+div.replies {
+ flex-direction: row;
+ display: flex;
+ align-items: center;
+ gap: 4px;
}
div.unread {
font-weight: bold;
}
-div.centerContainer {
- justify-content: center;
-}
-div.nonViewerMessageBoxContainer {
- justify-content: flex-start;
-}
-div.viewerMessageBoxContainer {
- justify-content: flex-end;
-}
+
svg.inlineSidebarIcon {
color: #666666;
}
diff --git a/web/chat/inline-sidebar.react.js b/web/chat/inline-sidebar.react.js
--- a/web/chat/inline-sidebar.react.js
+++ b/web/chat/inline-sidebar.react.js
@@ -2,61 +2,74 @@
import classNames from 'classnames';
import * as React from 'react';
-import {
- CornerDownRight as CornerDownRightIcon,
- CornerDownLeft as CornerDownLeftIcon,
-} from 'react-feather';
import useInlineSidebarText from 'lib/hooks/inline-sidebar-text.react';
import type { ThreadInfo } from 'lib/types/thread-types';
+import CommIcon from '../CommIcon.react';
import { useOnClickThread } from '../selectors/nav-selectors';
import css from './inline-sidebar.css';
type Props = {
- +threadInfo: ThreadInfo,
+ +threadInfo: ?ThreadInfo,
+ +reactions?: $ReadOnlyArray<string>,
+positioning: 'left' | 'center' | 'right',
};
function InlineSidebar(props: Props): React.Node {
- const { threadInfo } = props;
- const { sendersText, repliesText } = useInlineSidebarText(threadInfo);
+ const { threadInfo, positioning, reactions } = props;
+ const inlineSidebarText = useInlineSidebarText(threadInfo);
+
+ const containerClasses = classNames([
+ css.inlineSidebarContainer,
+ {
+ [css.leftContainer]: positioning === 'left',
+ [css.centerContainer]: positioning === 'center',
+ [css.rightContainer]: positioning === 'right',
+ },
+ ]);
+
+ const reactionsList = React.useMemo(() => {
+ if (!reactions || reactions.length === 0) {
+ return null;
+ }
+ const reactionsItems = reactions.map(reaction => {
+ return (
+ <div key={reaction} className={css.reactions}>
+ {reaction}
+ </div>
+ );
+ });
+ return <div className={css.reactionsContainer}>{reactionsItems}</div>;
+ }, [reactions]);
const onClick = useOnClickThread(threadInfo);
- let viewerIcon, nonViewerIcon, alignStyle;
- if (props.positioning === 'right') {
- viewerIcon = (
- <CornerDownLeftIcon className={css.inlineSidebarIcon} size={18} />
- );
- alignStyle = css.viewerMessageBoxContainer;
- } else if (props.positioning === 'left') {
- nonViewerIcon = (
- <CornerDownRightIcon className={css.inlineSidebarIcon} size={18} />
- );
- alignStyle = css.nonViewerMessageBoxContainer;
- } else {
- nonViewerIcon = (
- <CornerDownRightIcon className={css.inlineSidebarIcon} size={18} />
- );
- alignStyle = css.centerContainer;
- }
+ const threadInfoExists = !!threadInfo;
- const unreadStyle = threadInfo.currentUser.unread ? css.unread : null;
+ const sidebarItem = React.useMemo(() => {
+ if (!threadInfoExists || !inlineSidebarText) {
+ return null;
+ }
+
+ return (
+ <div className={css.replies}>
+ <CommIcon size={14} icon="sidebar-filled" />
+ {inlineSidebarText.repliesText}
+ </div>
+ );
+ }, [threadInfoExists, inlineSidebarText]);
return (
- <div className={classNames([css.inlineSidebarContent, alignStyle])}>
- <div onClick={onClick} className={css.inlineSidebar}>
- {nonViewerIcon}
- <div className={classNames([css.inlineSidebarName, unreadStyle])}>
- {sendersText}
- {repliesText}
- </div>
- {viewerIcon}
+ <div className={containerClasses}>
+ <div
+ className={css.inlineSidebarContent}
+ onClick={threadInfoExists ? onClick : null}
+ >
+ {sidebarItem}
+ {reactionsList}
</div>
</div>
);
}
-const inlineSidebarHeight = 20;
-
-export { InlineSidebar, inlineSidebarHeight };
+export default InlineSidebar;
diff --git a/web/chat/robotext-message.react.js b/web/chat/robotext-message.react.js
--- a/web/chat/robotext-message.react.js
+++ b/web/chat/robotext-message.react.js
@@ -13,7 +13,7 @@
import { linkRules } from '../markdown/rules.react';
import { updateNavInfoActionType } from '../redux/action-types';
import { useSelector } from '../redux/redux-utils';
-import { InlineSidebar } from './inline-sidebar.react';
+import InlineSidebar from './inline-sidebar.react';
import css from './robotext-message.css';
import { tooltipPositions, useMessageTooltip } from './tooltip-utils';
diff --git a/web/theme.css b/web/theme.css
--- a/web/theme.css
+++ b/web/theme.css
@@ -176,4 +176,7 @@
--chat-message-list-active-border: #5989d6;
--sidebars-modal-color: var(--shades-black-60);
--sidebars-modal-color-hover: var(--shades-white-100);
+ --inline-sidebar-bg: var(--shades-black-70);
+ --inline-sidebar-bg-hover: var(--shades-black-80);
+ --inline-sidebar-color: var(--fg);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 7:12 AM (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2583427
Default Alt Text
D4924.diff (6 KB)
Attached To
Mode
D4924: [web] Redesign `InlineSidebar` with reactions support
Attached
Detach File
Event Timeline
Log In to Comment