From 4a1c91e3820bddf58e2ea70bd6ae614e4ba4e3b2 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Sun, 2 Apr 2017 20:31:21 +0200 Subject: [PATCH] Improves wallet creation UI Resolves #7889 Auditors: @srirambv @bsclifton Test Plan: - Clear profile and create a new one - Enable payments in the new profile --- .../locales/en-US/preferences.properties | 1 - .../preferences/payment/enabledContent.js | 53 +++++++------------ .../components/preferences/paymentsTab.js | 50 +++++++---------- test/unit/app/renderer/paymentsTabTest.js | 11 ---- 4 files changed, 37 insertions(+), 78 deletions(-) diff --git a/app/extensions/brave/locales/en-US/preferences.properties b/app/extensions/brave/locales/en-US/preferences.properties index 5172dc2a4bd..70385eb8d24 100644 --- a/app/extensions/brave/locales/en-US/preferences.properties +++ b/app/extensions/brave/locales/en-US/preferences.properties @@ -59,7 +59,6 @@ syncCreate=Set up sync syncEnterPassphrase=Enter your sync code words: accountBalance=account balance accountBalanceConnectionError=Please check your Internet connection. -accountBalanceLoading=loading… monthlyBudget=monthly budget status=status statusOnError=Brave Wallet can't be reached. diff --git a/app/renderer/components/preferences/payment/enabledContent.js b/app/renderer/components/preferences/payment/enabledContent.js index 7aee2459f7a..fbd90ba22d4 100644 --- a/app/renderer/components/preferences/payment/enabledContent.js +++ b/app/renderer/components/preferences/payment/enabledContent.js @@ -4,6 +4,7 @@ const React = require('react') const {StyleSheet, css} = require('aphrodite') +const moment = require('moment') // util const {btcToCurrencyString, formattedDateFromTimestamp, walletStatus} = require('../../../../common/lib/ledgerUtil') @@ -75,18 +76,14 @@ class EnabledContent extends ImmutableComponent { fundsAmount () { const ledgerData = this.props.ledgerData - if (!ledgerData.get('created')) { - return null + let value = 0 + + if (!(ledgerData.get('balance') === undefined || ledgerData.get('balance') === null)) { + value = ledgerData.get('balance') } return
- { - !(ledgerData.get('balance') === undefined || ledgerData.get('balance') === null) - ? - : - - - } +
{ - this.props.ledgerData.get('created') && this.enabled + this.enabled ?
@@ -197,36 +199,18 @@ class PaymentsTab extends ImmutableComponent { />
- { - this.hasWalletTransaction && this.enabled - ? - : null - } - { - !this.hasWalletTransaction && this.enabled - ? {}} - /> - : null - } - { - this.props.ledgerData.get('created') && this.enabled - ? - : null - } + {}} + /> + {}} + />
: null @@ -330,6 +314,10 @@ const styles = StyleSheet.create({ }, advanceIcon: { '-webkit-mask-image': `url(${advanceIcon})` + }, + advanceIconDisabled: { + backgroundColor: globalStyles.color.chromeTertiary, + cursor: 'default' } }) diff --git a/test/unit/app/renderer/paymentsTabTest.js b/test/unit/app/renderer/paymentsTabTest.js index 0de8483e88c..06edd4acd39 100644 --- a/test/unit/app/renderer/paymentsTabTest.js +++ b/test/unit/app/renderer/paymentsTabTest.js @@ -176,17 +176,6 @@ describe('PaymentsTab component', function () { assert.equal(inst.fundsAmount, null) }) - it('handles missing balance', function () { - fakeSettings.mockReturnValue = true - const wrapper = mount( - - ) - assert.equal(wrapper.find('[data-test-id="accountBalanceLoading"]').length, 1) - }) - it('handles expected balance', function () { fakeSettings.mockReturnValue = true const wrapper = mount(