diff --git a/web/chat/chat-thread-list-item.react.js b/web/chat/chat-thread-list-item.react.js
index b53e13688..d81a5d07e 100644
--- a/web/chat/chat-thread-list-item.react.js
+++ b/web/chat/chat-thread-list-item.react.js
@@ -1,166 +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,
};
function ChatThreadListItem(props: Props): React.Node {
const { item } = 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, index) => {
if (sidebarItem.type === 'sidebar') {
const { type, ...sidebarInfo } = sidebarItem;
return (
0}
+ isSubsequentItem={index > 0}
key={sidebarInfo.threadInfo.id}
/>
);
} 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 (
<>
{sidebars}
>
);
}
export default ChatThreadListItem;
diff --git a/web/chat/chat-thread-list-sidebar.react.js b/web/chat/chat-thread-list-sidebar.react.js
index 32d9c5f2d..058c2a1ed 100644
--- a/web/chat/chat-thread-list-sidebar.react.js
+++ b/web/chat/chat-thread-list-sidebar.react.js
@@ -1,56 +1,53 @@
// @flow
import classNames from 'classnames';
import * as React from 'react';
import type { SidebarInfo } from 'lib/types/thread-types';
import {
useOnClickThread,
useThreadIsActive,
} from '../selectors/nav-selectors';
import ChatThreadListItemMenu from './chat-thread-list-item-menu.react';
import css from './chat-thread-list.css';
import SidebarItem from './sidebar-item.react';
type Props = {
+sidebarInfo: SidebarInfo,
- +isMultipleSidebarItem: boolean,
+ +isSubsequentItem: boolean,
};
function ChatThreadListSidebar(props: Props): React.Node {
- const { sidebarInfo, isMultipleSidebarItem } = props;
+ const { sidebarInfo, isSubsequentItem } = props;
const { threadInfo, mostRecentNonLocalMessage } = sidebarInfo;
const {
currentUser: { unread },
id: threadID,
} = threadInfo;
const active = useThreadIsActive(threadID);
const onClick = useOnClickThread(threadInfo);
let unreadDot;
if (unread) {
unreadDot = ;
}
return (
);
}
export default ChatThreadListSidebar;
diff --git a/web/chat/sidebar-item.react.js b/web/chat/sidebar-item.react.js
index 25e09aac0..c3a6ee044 100644
--- a/web/chat/sidebar-item.react.js
+++ b/web/chat/sidebar-item.react.js
@@ -1,43 +1,48 @@
// @flow
import classNames from 'classnames';
import * as React from 'react';
import type { SidebarInfo } from 'lib/types/thread-types';
import { useOnClickThread } from '../selectors/nav-selectors';
import SWMansionIcon from '../SWMansionIcon.react';
import css from './chat-thread-list.css';
type Props = {
+sidebarInfo: SidebarInfo,
+extendArrow?: boolean,
};
function SidebarItem(props: Props): React.Node {
const {
sidebarInfo: { threadInfo },
extendArrow = false,
} = props;
const {
currentUser: { unread },
} = threadInfo;
const onClick = useOnClickThread(threadInfo);
const unreadCls = classNames(css.sidebarTitle, { [css.unread]: unread });
+ let arrowExtender;
+ if (extendArrow) {
+ arrowExtender = ;
+ }
+
return (
<>
- {extendArrow ? : null}
+ {arrowExtender}
>
);
}
export default SidebarItem;