From b7bb0f03d744dcd58d818403cd9efad8d1d556b2 Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 20 Feb 2023 18:29:50 -0700 Subject: [PATCH] Do not display experiment settings tab when there are no settings to show (#17765) --- ui/pages/settings/settings.component.js | 117 +++++++++++++----------- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/ui/pages/settings/settings.component.js b/ui/pages/settings/settings.component.js index 6868f3ea1..c7989d6e3 100644 --- a/ui/pages/settings/settings.component.js +++ b/ui/pages/settings/settings.component.js @@ -78,6 +78,9 @@ class SettingsPage extends PureComponent { searchText: '', }; + shouldRenderExperimentalTab = + process.env.TRANSACTION_SECURITY_PROVIDER || process.env.NFTS_V1; + componentDidMount() { this.handleConversionDate(); } @@ -260,63 +263,65 @@ class SettingsPage extends PureComponent { renderTabs() { const { history, currentPath } = this.props; const { t } = this.context; + const tabs = [ + { + content: t('general'), + icon: , + key: GENERAL_ROUTE, + }, + { + content: t('advanced'), + icon: , + key: ADVANCED_ROUTE, + }, + { + content: t('contacts'), + icon: , + key: CONTACT_LIST_ROUTE, + }, + ///: BEGIN:ONLY_INCLUDE_IN(flask) + { + content: t('snaps'), + icon: ( + + ), + key: SNAPS_LIST_ROUTE, + }, + ///: END:ONLY_INCLUDE_IN + { + content: t('securityAndPrivacy'), + icon: , + key: SECURITY_ROUTE, + }, + { + content: t('alerts'), + icon: , + key: ALERTS_ROUTE, + }, + { + content: t('networks'), + icon: , + key: NETWORKS_ROUTE, + }, + ]; + + if (this.shouldRenderExperimentalTab) { + tabs.push({ + content: t('experimental'), + icon: , + key: EXPERIMENTAL_ROUTE, + }); + } + + tabs.push({ + content: t('about'), + icon: , + key: ABOUT_US_ROUTE, + }); return ( , - key: GENERAL_ROUTE, - }, - { - content: t('advanced'), - icon: , - key: ADVANCED_ROUTE, - }, - { - content: t('contacts'), - icon: , - key: CONTACT_LIST_ROUTE, - }, - ///: BEGIN:ONLY_INCLUDE_IN(flask) - { - content: t('snaps'), - icon: ( - - ), - key: SNAPS_LIST_ROUTE, - }, - ///: END:ONLY_INCLUDE_IN - { - content: t('securityAndPrivacy'), - icon: , - key: SECURITY_ROUTE, - }, - { - content: t('alerts'), - icon: , - key: ALERTS_ROUTE, - }, - { - content: t('networks'), - icon: , - key: NETWORKS_ROUTE, - }, - { - content: t('experimental'), - icon: , - key: EXPERIMENTAL_ROUTE, - }, - { - content: t('about'), - icon: , - key: ABOUT_US_ROUTE, - }, - ]} + tabs={tabs} isActive={(key) => { if (key === GENERAL_ROUTE && currentPath === SETTINGS_ROUTE) { return true; @@ -360,7 +365,9 @@ class SettingsPage extends PureComponent { render={() => } /> - + {this.shouldRenderExperimentalTab ? ( + + ) : null}