1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Do not display experiment settings tab when there are no settings to show (#17765)

This commit is contained in:
ryanml 2023-02-20 18:29:50 -07:00 committed by GitHub
parent cc99a25228
commit b7bb0f03d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: <i className="fa fa-cog" />,
key: GENERAL_ROUTE,
},
{
content: t('advanced'),
icon: <i className="fas fa-sliders-h" />,
key: ADVANCED_ROUTE,
},
{
content: t('contacts'),
icon: <Icon name={ICON_NAMES.BOOK} />,
key: CONTACT_LIST_ROUTE,
},
///: BEGIN:ONLY_INCLUDE_IN(flask)
{
content: t('snaps'),
icon: (
<i className="fa fa-flask" title={t('snapsSettingsDescription')} />
),
key: SNAPS_LIST_ROUTE,
},
///: END:ONLY_INCLUDE_IN
{
content: t('securityAndPrivacy'),
icon: <i className="fa fa-lock" />,
key: SECURITY_ROUTE,
},
{
content: t('alerts'),
icon: <Icon name={ICON_NAMES.NOTIFICATION} />,
key: ALERTS_ROUTE,
},
{
content: t('networks'),
icon: <i className="fa fa-plug" />,
key: NETWORKS_ROUTE,
},
];
if (this.shouldRenderExperimentalTab) {
tabs.push({
content: t('experimental'),
icon: <i className="fa fa-flask" />,
key: EXPERIMENTAL_ROUTE,
});
}
tabs.push({
content: t('about'),
icon: <i className="fa fa-info-circle" />,
key: ABOUT_US_ROUTE,
});
return (
<TabBar
tabs={[
{
content: t('general'),
icon: <i className="fa fa-cog" />,
key: GENERAL_ROUTE,
},
{
content: t('advanced'),
icon: <i className="fas fa-sliders-h" />,
key: ADVANCED_ROUTE,
},
{
content: t('contacts'),
icon: <Icon name={ICON_NAMES.BOOK} />,
key: CONTACT_LIST_ROUTE,
},
///: BEGIN:ONLY_INCLUDE_IN(flask)
{
content: t('snaps'),
icon: (
<i
className="fa fa-flask"
title={t('snapsSettingsDescription')}
/>
),
key: SNAPS_LIST_ROUTE,
},
///: END:ONLY_INCLUDE_IN
{
content: t('securityAndPrivacy'),
icon: <i className="fa fa-lock" />,
key: SECURITY_ROUTE,
},
{
content: t('alerts'),
icon: <Icon name={ICON_NAMES.NOTIFICATION} />,
key: ALERTS_ROUTE,
},
{
content: t('networks'),
icon: <i className="fa fa-plug" />,
key: NETWORKS_ROUTE,
},
{
content: t('experimental'),
icon: <i className="fa fa-flask" />,
key: EXPERIMENTAL_ROUTE,
},
{
content: t('about'),
icon: <i className="fa fa-info-circle" />,
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={() => <AddNetwork />}
/>
<Route exact path={SECURITY_ROUTE} component={SecurityTab} />
<Route exact path={EXPERIMENTAL_ROUTE} component={ExperimentalTab} />
{this.shouldRenderExperimentalTab ? (
<Route exact path={EXPERIMENTAL_ROUTE} component={ExperimentalTab} />
) : null}
<Route exact path={CONTACT_LIST_ROUTE} component={ContactListTab} />
<Route exact path={CONTACT_ADD_ROUTE} component={ContactListTab} />
<Route