diff --git a/web/chat/chat-thread-list-item.react.js b/web/chat/chat-thread-list-item.react.js index 6a76d8294..262440e9c 100644 --- a/web/chat/chat-thread-list-item.react.js +++ b/web/chat/chat-thread-list-item.react.js @@ -1,157 +1,166 @@ // @flow import classNames from 'classnames'; import * as React from 'react'; import type { ChatThreadItem } from 'lib/selectors/chat-selectors'; import { useAncestorThreads } from 'lib/shared/ancestor-threads'; import { shortAbsoluteDate } from 'lib/utils/date-utils'; import { useSelector } from '../redux/redux-utils'; import { useOnClickThread, useThreadIsActive, } from '../selectors/nav-selectors'; import SWMansionIcon from '../SWMansionIcon.react'; import ChatThreadListItemMenu from './chat-thread-list-item-menu.react'; import ChatThreadListSeeMoreSidebars from './chat-thread-list-see-more-sidebars.react'; import ChatThreadListSidebar from './chat-thread-list-sidebar.react'; import css from './chat-thread-list.css'; import MessagePreview from './message-preview.react'; type Props = { +item: ChatThreadItem, +setModal: (modal: ?React.Node) => void, }; function ChatThreadListItem(props: Props): React.Node { const { item, setModal } = props; const { threadInfo, lastUpdatedTimeIncludingSidebars, mostRecentNonLocalMessage, mostRecentMessageInfo, } = item; const { id: threadID, currentUser } = threadInfo; const ancestorThreads = useAncestorThreads(threadInfo); const onClick = useOnClickThread(item.threadInfo); const timeZone = useSelector(state => state.timeZone); const lastActivity = shortAbsoluteDate( lastUpdatedTimeIncludingSidebars, timeZone, ); const active = useThreadIsActive(threadID); const containerClassName = React.useMemo( () => classNames({ [css.thread]: true, [css.activeThread]: active, }), [active], ); const { unread } = currentUser; const titleClassName = React.useMemo( () => classNames({ [css.title]: true, [css.unread]: unread, }), [unread], ); const lastActivityClassName = React.useMemo( () => classNames({ [css.lastActivity]: true, [css.unread]: unread, [css.dark]: !unread, }), [unread], ); const breadCrumbsClassName = React.useMemo( () => classNames(css.breadCrumbs, { [css.unread]: unread, }), [unread], ); + let unreadDot; + if (unread) { + unreadDot =
; + } + const { color } = item.threadInfo; const colorSplotchStyle = React.useMemo( () => ({ backgroundColor: `#${color}` }), [color], ); const sidebars = item.sidebars.map(sidebarItem => { if (sidebarItem.type === 'sidebar') { const { type, ...sidebarInfo } = sidebarItem; return ( ); } else if (sidebarItem.type === 'seeMore') { return ( ); } else { return
; } }); const ancestorPath = ancestorThreads.map((thread, idx) => { const isNotLast = idx !== ancestorThreads.length - 1; const chevron = isNotLast && ( ); return ( {thread.uiName} {chevron} ); }); return ( <>
-
+
+
{unreadDot}
+ +
+

{ancestorPath}

{threadInfo.uiName}
{lastActivity}
{sidebars} ); } export default ChatThreadListItem; diff --git a/web/chat/chat-thread-list.css b/web/chat/chat-thread-list.css index b1e04584f..31a38caa9 100644 --- a/web/chat/chat-thread-list.css +++ b/web/chat/chat-thread-list.css @@ -1,280 +1,296 @@ div.thread { display: flex; flex-direction: row; align-items: flex-start; padding-top: 4px; padding-bottom: 4px; - padding-left: 16px; padding-right: 10px; } div.threadListSideBar { display: flex; flex-direction: row; align-items: flex-start; padding-bottom: 4px; padding-left: 16px; padding-right: 10px; position: relative; } div.threadListSideBar > svg { position: absolute; top: -13px; left: 30px; } div.thread:first-child { padding-top: 6px; } div.activeThread, div.thread:hover { background: var(--selected-thread-bg); } div.thread div.title { flex: 1; font-size: var(--m-font-16); font-weight: var(--semi-bold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--thread-color-read); line-height: var(--line-height-text); } a.threadButton { flex: 1; cursor: pointer; overflow: hidden; padding-left: 8px; } .threadButtonSidebar { flex: 1; cursor: pointer; overflow: hidden; padding-left: 8px; } p.breadCrumbs { display: flex; font-size: var(--xs-font-12); font-weight: var(--normal); color: var(--breadcrumb-color); } p.breadCrumbs.unread { color: var(--breadcrumb-color-unread); } span.breadCrumb { display: flex; align-items: center; white-space: nowrap; text-overflow: ellipsis; } +div.colorContainer { + display: flex; +} + div.spacer, div.colorSplotch { height: 40px; width: 40px; border-radius: 1.68px; } div.lastActivity { font-size: var(--xxs-font-10); color: var(--fg); line-height: 1.5; font-weight: var(--semi-bold); white-space: nowrap; } div.lastMessage { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; } div.threadRow > .lastMessage { color: var(--thread-last-message-color-read); font-size: var(--s-font-14); } div.thread.activeThread a { color: red; } div.unread { color: var(--fg); font-weight: var(--semi-bold); } div.lastMessage.black { color: var(--fg); } div.dark { color: var(--thread-color-read); } .light { color: var(--thread-from-color-read); } +div.dotContainer { + display: flex; + align-items: center; + justify-content: center; + width: 16px; +} +div.unreadDot { + height: 4px; + width: 4px; + background: var(--fg); + border-radius: 15px; + align-self: center; +} div.italic { font-style: italic; } div.sidebarTitle { flex: 1; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--thread-color-read); align-self: flex-start; } div.sidebarLastActivity { white-space: nowrap; font-size: var(--xxs-font-10); line-height: var(--line-height-text); font-weight: var(--semi-bold); } svg.sidebarIcon { color: var(--thread-color-read); padding: 0 6px; font-size: 20px; } div.sidebar .menu > button svg { font-size: 16px; color: var(--thread-color-read); } div.sidebar .menu { opacity: 0; } div.sidebar:hover .menu { display: flex; align-self: flex-end; opacity: 1; } .menu { position: relative; display: flex; padding: 5px; justify-content: flex-end; } .menu > button { background-color: transparent; color: var(--thread-color-read); border: none; cursor: pointer; display: flex; align-items: center; } .menu > button:focus { outline: none; } .menuContent { display: none; position: absolute; top: calc(100% + 1px); right: 0; z-index: 1; width: max-content; overflow: hidden; background-color: #eeeeee; border-radius: 5px; box-shadow: 1px 1px 5px 2px #00000022; } button.menuContent { border: none; cursor: pointer; padding: 10px; font-size: 16px; } .menuContent button:hover { background-color: #dddddd; } ul.list { margin: 5px 3px 10px 0px; overflow: auto; } div.search { display: flex; background-color: #dddddd; border-radius: 5px; padding: 3px 5px; align-items: center; } svg.searchVector { fill: #aaaaaa; height: 22px; width: 22px; padding: 0 3px; margin-left: 8px; } div.search > input { color: black; padding: 0; border: none; background-color: #dddddd; font-weight: 600; font-size: 15px; flex-grow: 1; margin-left: 3px; } div.search > input:focus { outline: none; } svg.clearQuery { font-size: 15px; padding-bottom: 1px; padding-right: 2px; color: #aaaaaa; } svg.clearQuery:hover { font-size: 15px; padding-bottom: 1px; padding-right: 2px; color: white; } div.spacer { height: 6px; } div.emptyItem { padding: 10px; font-size: 16px; text-align: center; white-space: pre-wrap; color: var(--fg); } div.threadListContainer { display: flex; flex-direction: column; } div.searchContainer { background-color: var(--text-input-bg); display: flex; align-items: center; margin: 1rem; } input.searchInput { background-color: var(--text-input-bg); font-size: var(--s-font-14); padding: 1rem; flex: 1; border: none; color: var(--text-input-color); outline: none; } input.searchInput::placeholder { color: var(--text-input-placeholder); } button.clearSearch { color: var(--text-input-color); transition: ease-in-out 0.15s; border: none; padding: 0 1rem; font-size: var(--m-font-16); background: none; } button.clearSearchDisabled { opacity: 0; }