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:
parent
7afd3156e0
commit
d4842b089e
@ -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,15 +316,24 @@ 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() {
|
||||
const { history, clearPendingTokens, mostRecentOverviewPage } = this.props;
|
||||
|
@ -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',
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,7 @@ describe('Add Token', function () {
|
||||
tokens: [],
|
||||
identities: {},
|
||||
mostRecentOverviewPage: '/',
|
||||
showSearchTab: true,
|
||||
};
|
||||
|
||||
describe('Add Token', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user