From 43043e2ec2db1349dd5aa1e3d6e2b56c4befcc46 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Fri, 12 Apr 2019 15:06:44 +0200 Subject: [PATCH] moved hasSignVerify constant to global config --- public/data/appConfig.json | 18 ++++++++++++------ .../constants/navigation.js | 3 --- .../components/TopNavigationAccount/index.js | 8 ++++++-- 3 files changed, 18 insertions(+), 11 deletions(-) delete mode 100644 src/views/Wallet/components/TopNavigationAccount/constants/navigation.js diff --git a/public/data/appConfig.json b/public/data/appConfig.json index 5d6326e1..ee2fe5b8 100644 --- a/public/data/appConfig.json +++ b/public/data/appConfig.json @@ -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 } ], diff --git a/src/views/Wallet/components/TopNavigationAccount/constants/navigation.js b/src/views/Wallet/components/TopNavigationAccount/constants/navigation.js deleted file mode 100644 index 4556a03a..00000000 --- a/src/views/Wallet/components/TopNavigationAccount/constants/navigation.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - HAS_SIGN_VERIFY: ['ethereum', 'bitcoin'], -}; diff --git a/src/views/Wallet/components/TopNavigationAccount/index.js b/src/views/Wallet/components/TopNavigationAccount/index.js index d25ff210..02a514ce 100644 --- a/src/views/Wallet/components/TopNavigationAccount/index.js +++ b/src/views/Wallet/components/TopNavigationAccount/index.js @@ -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, selectedAccount: $ElementType, + localStorage: $ElementType, }; type LocalState = { wrapper: ?HTMLElement, @@ -89,10 +89,13 @@ class TopNavigationAccount extends React.PureComponent { 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 { - {navigationConstants.HAS_SIGN_VERIFY.includes(network.type) && ( + {networkConfig.hasSignVerify && ( @@ -124,6 +127,7 @@ export default connect( (state: State): Props => ({ router: state.router, selectedAccount: state.selectedAccount, + localStorage: state.localStorage, }), null )(TopNavigationAccount);