diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -160,6 +160,10 @@ return !!(threadInfo && threadInfo.type !== threadTypes.SIDEBAR); } +function threadIsSidebar(threadInfo: ?(ThreadInfo | RawThreadInfo)): boolean { + return threadInfo?.type === threadTypes.SIDEBAR; +} + function threadInBackgroundChatList( threadInfo: ?(ThreadInfo | RawThreadInfo), ): boolean { @@ -1403,6 +1407,7 @@ threadInChatList, threadIsTopLevel, threadIsChannel, + threadIsSidebar, threadInBackgroundChatList, threadInHomeChatList, threadIsInHome, diff --git a/web/modals/threads/sidebars/sidebars-modal.css b/web/modals/threads/sidebars/sidebars-modal.css --- a/web/modals/threads/sidebars/sidebars-modal.css +++ b/web/modals/threads/sidebars/sidebars-modal.css @@ -1,3 +1,11 @@ +div.sidebarListContainer { + display: flex; + flex-direction: column; + line-height: var(--line-height-text); + width: 383px; + height: 458px; +} + div.sidebarList { overflow: auto; color: var(--sidebars-modal-color); diff --git a/web/modals/threads/sidebars/sidebars-modal.react.js b/web/modals/threads/sidebars/sidebars-modal.react.js new file mode 100644 --- /dev/null +++ b/web/modals/threads/sidebars/sidebars-modal.react.js @@ -0,0 +1,80 @@ +// @flow + +import * as React from 'react'; + +import { useFilteredChildThreads } from 'lib/hooks/child-threads'; +import { threadInChatList, threadIsSidebar } from 'lib/shared/thread-utils'; + +import Tabs from '../../../components/tabs.react'; +import SearchModal from '../../search-modal.react'; +import SidebarList from './sidebar-list.react'; +import css from './sidebars-modal.css'; + +type SidebarTab = 'All Threads' | 'My Threads'; + +type ContentProps = { + +searchText: string, + +threadID: string, + +defaultTab: SidebarTab, +}; + +function SidebarsModalContent(props: ContentProps): React.Node { + const { searchText, threadID, defaultTab } = props; + const [tab, setTab] = React.useState(defaultTab); + + const sidebarList = useFilteredChildThreads(threadID, { + predicate: threadIsSidebar, + searchText, + }); + + const sidebarsChatListVisibleInChat = sidebarList.filter(chatItem => + threadInChatList(chatItem.threadInfo), + ); + + return ( +
+ + + + + + + + +
+ ); +} + +type Props = { + +threadID: string, + +onClose: () => void, + +defaultTab?: SidebarTab, +}; + +function SidebarsModal(props: Props): React.Node { + const { threadID, onClose, defaultTab = 'All Threads' } = props; + + const sidebarsContent = React.useCallback( + (searchText: string) => ( + + ), + [defaultTab, threadID], + ); + + return ( + + {sidebarsContent} + + ); +} + +export default SidebarsModal;