diff --git a/web/modals/threads/settings/thread-settings-delete-tab.css b/web/modals/threads/settings/thread-settings-delete-tab.css --- a/web/modals/threads/settings/thread-settings-delete-tab.css +++ b/web/modals/threads/settings/thread-settings-delete-tab.css @@ -7,6 +7,7 @@ div.warning_container { display: flex; flex-direction: row; + color: var(--text-background-primary-default); } .warning_icon { @@ -15,7 +16,6 @@ .deletion_warning { font-weight: var(--bold); - color: var(--fg); font-size: var(--s-font-14); margin-bottom: 16px; } diff --git a/web/modals/threads/settings/thread-settings-modal.react.js b/web/modals/threads/settings/thread-settings-modal.react.js --- a/web/modals/threads/settings/thread-settings-modal.react.js +++ b/web/modals/threads/settings/thread-settings-modal.react.js @@ -27,7 +27,7 @@ import css from './thread-settings-modal.css'; import ThreadSettingsPrivacyTab from './thread-settings-privacy-tab.react.js'; import ThreadSettingsRelationshipTab from './thread-settings-relationship-tab.react.js'; -import Tabs from '../../../components/tabs-legacy.react.js'; +import Tabs, { type TabData } from '../../../components/tabs.react.js'; import { useSelector } from '../../../redux/redux-utils.js'; import Modal from '../../modal.react.js'; @@ -137,19 +137,61 @@ React.useEffect(() => () => setErrorMessage(''), [currentTabType]); - if (!threadInfo) { - return ( - -
-

You no longer have permission to view this chat

-
-
- ); - } + const tabsData: $ReadOnlyArray> = React.useMemo(() => { + if (!threadInfo) { + return []; + } + + const result = [{ id: 'general', header: 'General' }]; + + // This UI needs to be updated to handle sidebars but we haven't gotten + // there yet. We'll probably end up ripping it out anyways, so for now we + // are just hiding the privacy tab for any thread that was created as a + // sidebar + const canSeePrivacyTab = + (queuedChanges['parentThreadID'] ?? threadInfo['parentThreadID']) && + !threadInfo.sourceMessageID && + (threadInfo.type === threadTypes.COMMUNITY_OPEN_SUBTHREAD || + threadInfo.type === threadTypes.COMMUNITY_SECRET_SUBTHREAD); - const tabs = [ - -
+ if (canSeePrivacyTab) { + result.push({ id: 'privacy', header: 'Privacy' }); + } + + if (availableRelationshipActions.length > 0 && otherUserInfo) { + result.push({ id: 'relationship', header: 'Relationship' }); + } + + if (hasPermissionForTab(threadInfo, 'delete')) { + result.push({ id: 'delete', header: 'Delete' }); + } + + return result; + }, [ + availableRelationshipActions.length, + hasPermissionForTab, + otherUserInfo, + queuedChanges, + threadInfo, + ]); + + const tabs = React.useMemo( + () => ( + + ), + [currentTabType, tabsData], + ); + + const tabContent = React.useMemo(() => { + if (!threadInfo) { + return null; + } + if (currentTabType === 'general') { + return ( -
-
, - ]; - - // This UI needs to be updated to handle sidebars but we haven't gotten - // there yet. We'll probably end up ripping it out anyways, so for now we - // are just hiding the privacy tab for any thread that was created as a - // sidebar - const canSeePrivacyTab = - (queuedChanges['parentThreadID'] ?? threadInfo['parentThreadID']) && - !threadInfo.sourceMessageID && - (threadInfo.type === threadTypes.COMMUNITY_OPEN_SUBTHREAD || - threadInfo.type === threadTypes.COMMUNITY_SECRET_SUBTHREAD); - if (canSeePrivacyTab) { - tabs.push( - -
- -
-
, - ); - } - - if (availableRelationshipActions.length > 0 && otherUserInfo) { - tabs.push( - -
- -
{errorMessage}
-
-
, + ); + } + if (currentTabType === 'privacy') { + return ( + + ); + } + if (currentTabType === 'relationship') { + invariant(otherUserInfo, 'otherUserInfo should be set'); + return ( + + ); + } + return ( + ); - } + }, [ + availableRelationshipActions, + changeInProgress, + currentTabType, + errorMessage, + namePlaceholder, + otherUserInfo, + queuedChanges, + threadInfo, + ]); - const canDeleteThread = hasPermissionForTab(threadInfo, 'delete'); - if (canDeleteThread) { - tabs.push( - -
- + if (!threadInfo) { + return ( + +
+

You no longer have permission to view this chat

- , +
); } @@ -228,9 +262,8 @@ size="fit-content" >
- - {tabs} - + {tabs} +
{tabContent}
);