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

Fix 10562 - Hide the suggested token pane when not on Mainnet or test network (#10702)

This commit is contained in:
David Walsh 2021-03-25 14:25:22 -05:00 committed by GitHub
parent 7afd3156e0
commit d4842b089e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 7 deletions

View File

@ -28,6 +28,7 @@ class AddToken extends Component {
clearPendingTokens: PropTypes.func,
tokens: PropTypes.array,
identities: PropTypes.object,
showSearchTab: PropTypes.bool.isRequired,
mostRecentOverviewPage: PropTypes.string.isRequired,
};
@ -315,14 +316,23 @@ class AddToken extends Component {
}
renderTabs() {
return (
<Tabs>
<Tab name={this.context.t('search')}>{this.renderSearchToken()}</Tab>
<Tab name={this.context.t('customToken')}>
{this.renderCustomTokenForm()}
</Tab>
</Tabs>
const { showSearchTab } = this.props;
const tabs = [];
if (showSearchTab) {
tabs.push(
<Tab name={this.context.t('search')} key="search-tab">
{this.renderSearchToken()}
</Tab>,
);
}
tabs.push(
<Tab name={this.context.t('customToken')} key="custom-tab">
{this.renderCustomTokenForm()}
</Tab>,
);
return <Tabs>{tabs}</Tabs>;
}
render() {

View File

@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import { setPendingTokens, clearPendingTokens } from '../../store/actions';
import { getMostRecentOverviewPage } from '../../ducks/history/history';
import { getIsMainnet } from '../../selectors/selectors';
import AddToken from './add-token.component';
const mapStateToProps = (state) => {
@ -13,6 +14,7 @@ const mapStateToProps = (state) => {
mostRecentOverviewPage: getMostRecentOverviewPage(state),
tokens,
pendingTokens,
showSearchTab: getIsMainnet(state) || process.env.IN_TEST === 'true',
};
};

View File

@ -26,6 +26,7 @@ describe('Add Token', function () {
tokens: [],
identities: {},
mostRecentOverviewPage: '/',
showSearchTab: true,
};
describe('Add Token', function () {