From c72ced79aeb3d79d12ae240b680e0561122e5209 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Tue, 14 Aug 2018 19:22:00 -0400 Subject: ui fixes --- .../connect-hardware/connect-screen.js | 15 +++++++------- .../pages/create-account/connect-hardware/index.js | 24 +++++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) (limited to 'ui/app/components/pages/create-account/connect-hardware') diff --git a/ui/app/components/pages/create-account/connect-hardware/connect-screen.js b/ui/app/components/pages/create-account/connect-hardware/connect-screen.js index af144d410..0a62f1c1e 100644 --- a/ui/app/components/pages/create-account/connect-hardware/connect-screen.js +++ b/ui/app/components/pages/create-account/connect-hardware/connect-screen.js @@ -12,7 +12,7 @@ class ConnectScreen extends Component { h('div.new-account-connect-form.unsupported-browser', {}, [ h('div.hw-connect', [ h('h3.hw-connect__title', {}, this.context.t('browserNotSupported')), - h('p.hw-connect__msg', {}, this.context.t('chromeRequiredForTrezor')), + h('p.hw-connect__msg', {}, this.context.t('chromeRequiredForHardwareWallets')), ]), h( 'button.btn-primary.btn--large', @@ -30,8 +30,8 @@ class ConnectScreen extends Component { renderHeader () { return ( h('div.hw-connect__header', {}, [ - h('h3.hw-connect__header__title', {}, this.context.t(`hardwareSupport`)), - h('p.hw-connect__header__msg', {}, this.context.t(`hardwareSupportMsg`)), + h('h3.hw-connect__header__title', {}, this.context.t(`hardwareWallets`)), + h('p.hw-connect__header__msg', {}, this.context.t(`hardwareWalletsMsg`)), ]) ) } @@ -50,7 +50,7 @@ class ConnectScreen extends Component { return h( 'button.btn-primary.btn--large', { onClick: this.props.connectToHardwareWallet.bind(this, 'trezor') }, - this.props.btnText + this.context.t('connectToTrezor') ) } @@ -58,7 +58,7 @@ class ConnectScreen extends Component { return h( 'button.btn-primary.btn--large', { onClick: this.props.connectToHardwareWallet.bind(this, 'ledger') }, - this.props.btnText.replace('Trezor', 'Ledger') + this.context.t('connectToLedger') ) } @@ -127,9 +127,9 @@ class ConnectScreen extends Component { return ( h('div.new-account-connect-form', {}, [ this.renderHeader(), - this.renderTrezorAffiliateLink(), - this.renderConnectToTrezorButton(), this.renderConnectToLedgerButton(), + this.renderConnectToTrezorButton(), + this.renderTrezorAffiliateLink(), this.renderLearnMore(), this.renderTutorialSteps(), this.renderFooter(), @@ -147,7 +147,6 @@ class ConnectScreen extends Component { ConnectScreen.propTypes = { connectToHardwareWallet: PropTypes.func.isRequired, - btnText: PropTypes.string.isRequired, browserSupported: PropTypes.bool.isRequired, } diff --git a/ui/app/components/pages/create-account/connect-hardware/index.js b/ui/app/components/pages/create-account/connect-hardware/index.js index e7e94686a..068b27cc2 100644 --- a/ui/app/components/pages/create-account/connect-hardware/index.js +++ b/ui/app/components/pages/create-account/connect-hardware/index.js @@ -6,14 +6,14 @@ const actions = require('../../../../actions') const ConnectScreen = require('./connect-screen') const AccountList = require('./account-list') const { DEFAULT_ROUTE } = require('../../../../routes') -const { formatBalance } = require('../../../../util') +const { formatBalance, getPlatform } = require('../../../../../../app/scripts/lib/util') +const { PLATFORM_FIREFOX } = require('../../../../../../app/scripts/lib/enums') class ConnectHardwareForm extends Component { constructor (props, context) { super(props) this.state = { error: null, - btnText: context.t('connectToTrezor'), selectedAccount: null, accounts: [], browserSupported: true, @@ -49,17 +49,22 @@ class ConnectHardwareForm extends Component { } connectToHardwareWallet = (device) => { + // None of the hardware wallets are supported + // At least for now + if (getPlatform() === PLATFORM_FIREFOX) { + this.setState({ browserSupported: false, error: null}) + return null + } + if (this.state.accounts.length) { return null } // Default values - this.setState({ btnText: this.context.t('connecting')}) this.getPage(device, 0, this.props.defaultHdPaths[device]) } onPathChange = (path) => { - console.log('BRUNO: path changed', path) this.props.setHardwareWalletDefaultHdPath({device: this.state.device, path}) this.getPage(this.state.device, 0, path) } @@ -92,7 +97,7 @@ class ConnectHardwareForm extends Component { this.showTemporaryAlert() } - const newState = { unlocked: true, device } + const newState = { unlocked: true, device, error: null } // Default to the first account if (this.state.selectedAccount === null) { accounts.forEach((a, i) => { @@ -119,9 +124,10 @@ class ConnectHardwareForm extends Component { }) .catch(e => { if (e === 'Window blocked') { - this.setState({ browserSupported: false }) + this.setState({ browserSupported: false, error: null}) + } else { + this.setState({ error: e.toString() }) } - this.setState({ btnText: this.context.t('connectToTrezor') }) }) } @@ -130,7 +136,6 @@ class ConnectHardwareForm extends Component { .then(_ => { this.setState({ error: null, - btnText: this.context.t('connectToTrezor'), selectedAccount: null, accounts: [], unlocked: false, @@ -160,7 +165,7 @@ class ConnectHardwareForm extends Component { renderError () { return this.state.error - ? h('span.error', { style: { marginBottom: 40 } }, this.state.error) + ? h('span.error', { style: { margin: '20px 20px 10px', display: 'block', textAlign: 'center' } }, this.state.error) : null } @@ -168,7 +173,6 @@ class ConnectHardwareForm extends Component { if (!this.state.accounts.length) { return h(ConnectScreen, { connectToHardwareWallet: this.connectToHardwareWallet, - btnText: this.state.btnText, browserSupported: this.state.browserSupported, }) } -- cgit