diff --git a/web/modals/threads/thread-settings-modal.react.js b/web/modals/threads/thread-settings-modal.react.js --- a/web/modals/threads/thread-settings-modal.react.js +++ b/web/modals/threads/thread-settings-modal.react.js @@ -1,6 +1,5 @@ // @flow -import classNames from 'classnames'; import invariant from 'invariant'; import * as React from 'react'; @@ -18,6 +17,7 @@ type ThreadChanges, } from 'lib/types/thread-types'; +import Tabs from '../../components/tabs.react'; import { useModalContext } from '../../modals/modal-provider.react'; import { useSelector } from '../../redux/redux-utils'; import Modal from '../modal.react'; @@ -27,31 +27,6 @@ import ThreadSettingsPrivacyTab from './thread-settings-privacy-tab.react'; type TabType = 'general' | 'privacy' | 'delete'; -type TabProps = { - +name: string, - +tabType: TabType, - +selected: boolean, - +onClick: (tabType: TabType) => void, -}; -class Tab extends React.PureComponent { - render() { - const classNamesForTab = classNames({ - [css['current-tab']]: this.props.selected, - [css['delete-tab']]: - this.props.selected && this.props.tabType === 'delete', - }); - return ( -
  • - {this.props.name} -
  • - ); - } - - onClick = () => { - return this.props.onClick(this.props.tabType); - }; -} - type BaseProps = { +threadID: string, }; @@ -134,9 +109,8 @@ const inputDisabled = changeInProgress || !hasPermissionForTab(threadInfo, currentTabType); - let mainContent; - if (currentTabType === 'general') { - mainContent = ( + const tabs = [ + - ); - } else if (currentTabType === 'privacy') { - mainContent = ( - - ); - } else if (currentTabType === 'delete') { - mainContent = ( - - ); - } - - const tabs = [ - , + , ]; // This UI needs to be updated to handle sidebars but we haven't gotten @@ -185,38 +131,43 @@ threadInfo.sourceMessageID && (threadInfo.type === threadTypes.COMMUNITY_OPEN_SUBTHREAD || threadInfo.type === threadTypes.COMMUNITY_SECRET_SUBTHREAD); - if (canSeePrivacyTab) { tabs.push( - , + + + , ); } const canDeleteThread = hasPermissionForTab(threadInfo, 'delete'); if (canDeleteThread) { tabs.push( - , + + + , ); } return ( -
      {tabs}
    - {mainContent} + + {tabs} +
    {errorMessage}