moved hasSignVerify constant to global config

pull/492/head
Vladimir Volek 5 years ago
parent 3b8e12e7ef
commit 43043e2ec2

@ -6,7 +6,8 @@
"type": "bitcoin",
"name": "Bitcoin",
"symbol": "BTC",
"shortcut": "btc"
"shortcut": "btc",
"hasSignVerify": true
},
{
"order": 2,
@ -27,7 +28,8 @@
"explorer": {
"tx": "https://etherscan.io/tx/",
"address": "https://etherscan.io/address/"
}
},
"hasSignVerify": true
},
{
"order": 18,
@ -48,7 +50,8 @@
"explorer": {
"tx": "https://gastracker.io/tx/",
"address": "https://gastracker.io/addr/"
}
},
"hasSignVerify": true
},
{
"order": 2,
@ -82,7 +85,8 @@
"explorer": {
"tx": "https://ropsten.etherscan.io/tx/",
"address": "https://ropsten.etherscan.io/address/"
}
},
"hasSignVerify": true
},
{
"order": 3,
@ -103,7 +107,8 @@
"explorer": {
"tx": "https://xrpcharts.ripple.com/#/transactions/",
"address": "https://xrpcharts.ripple.com/#/graph/"
}
},
"hasSignVerify": false
},
{
"order": 3,
@ -125,7 +130,8 @@
"explorer": {
"tx": "https://sisyfos.trezor.io/ripple-testnet-explorer/tx/",
"address": "https://sisyfos.trezor.io/ripple-testnet-explorer/address/"
}
},
"hasSignVerify": false
}
],

@ -1,3 +0,0 @@
export default {
HAS_SIGN_VERIFY: ['ethereum', 'bitcoin'],
};

@ -8,7 +8,6 @@ import { connect } from 'react-redux';
import { colors } from 'trezor-ui-components';
import type { State } from 'flowtype';
import { FormattedMessage } from 'react-intl';
import navigationConstants from './constants/navigation';
import l10nMessages from './index.messages';
import Indicator from './components/Indicator';
@ -16,6 +15,7 @@ import Indicator from './components/Indicator';
type Props = {
router: $ElementType<State, 'router'>,
selectedAccount: $ElementType<State, 'selectedAccount'>,
localStorage: $ElementType<State, 'localStorage'>,
};
type LocalState = {
wrapper: ?HTMLElement,
@ -89,10 +89,13 @@ class TopNavigationAccount extends React.PureComponent<Props, LocalState> {
wrapper: ?HTMLElement;
render() {
const { config } = this.props.localStorage;
const { state, pathname } = this.props.router.location;
if (!state) return null;
const { network } = this.props.selectedAccount;
if (!network) return null;
const networkConfig = config.networks.find(c => c.shortcut === network.shortcut);
if (!networkConfig) return null;
const basePath = `/device/${state.device}/network/${state.network}/account/${
state.account
@ -109,7 +112,7 @@ class TopNavigationAccount extends React.PureComponent<Props, LocalState> {
<StyledNavLink to={`${basePath}/send`}>
<FormattedMessage {...l10nMessages.TR_NAV_SEND} />
</StyledNavLink>
{navigationConstants.HAS_SIGN_VERIFY.includes(network.type) && (
{networkConfig.hasSignVerify && (
<StyledNavLink to={`${basePath}/signverify`}>
<FormattedMessage {...l10nMessages.TR_NAV_SIGN_AND_VERIFY} />
</StyledNavLink>
@ -124,6 +127,7 @@ export default connect(
(state: State): Props => ({
router: state.router,
selectedAccount: state.selectedAccount,
localStorage: state.localStorage,
}),
null
)(TopNavigationAccount);

Loading…
Cancel
Save