From 260de6532c50dceebee93acab70a3319afdb16fb Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 5 Aug 2016 12:18:44 -0700 Subject: Get fiat numbers rendering on tooltip. Need to find way to create line breaks. --- ui/app/components/eth-balance.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 612ef7779..4ecb436ee 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -1,10 +1,22 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits +const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') -module.exports = EthBalanceComponent + + +function mapStateToProps (state) { + return { + conversionRate: state.metamask.conversionRate, + conversionDate: state.metamask.conversionDate, + currentFiat: state.metamask.currentFiat, + } +} + +module.exports = connect(mapStateToProps)(EthBalanceComponent) + inherits(EthBalanceComponent, Component) function EthBalanceComponent () { @@ -37,6 +49,11 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { if (value === 'None') return value var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) var balance + var splitBalance = value.split(' ') + var ethNumber = splitBalance[0] + var ethSuffix = splitBalance[1] + var fiatNumber = Number(splitBalance[0]) * state.conversionRate + var fiatSuffix = state.currentFiat if (state.shorten) { balance = balanceObj.shortBalance @@ -49,7 +66,9 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { return ( h(Tooltip, { position: 'bottom', - title: value.split(' ')[0], + multiline: true, + title: `${ethNumber} ${ethSuffix} + ${fiatNumber} ${fiatSuffix}`, }, [ h('.flex-column', { style: { -- cgit v1.2.3 From 637d3978b716a7f32cf603b70155d8db90509af2 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 9 Aug 2016 16:33:58 -0700 Subject: Fix default value. Add loading indication for async. --- ui/app/components/eth-balance.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 4ecb436ee..1a7f75db9 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -6,6 +6,7 @@ const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') +module.exports = connect(mapStateToProps)(EthBalanceComponent) function mapStateToProps (state) { return { @@ -15,9 +16,6 @@ function mapStateToProps (state) { } } -module.exports = connect(mapStateToProps)(EthBalanceComponent) - - inherits(EthBalanceComponent, Component) function EthBalanceComponent () { Component.call(this) -- cgit v1.2.3 From 009784c79b5c0ebfd9dbe9536870c55e906e914d Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 16 Aug 2016 10:34:29 -0700 Subject: Divided eth components for tx and account detail. --- ui/app/components/eth-balance.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 1a7f75db9..a5584a235 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -6,15 +6,7 @@ const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') -module.exports = connect(mapStateToProps)(EthBalanceComponent) - -function mapStateToProps (state) { - return { - conversionRate: state.metamask.conversionRate, - conversionDate: state.metamask.conversionDate, - currentFiat: state.metamask.currentFiat, - } -} +module.exports = EthBalanceComponent inherits(EthBalanceComponent, Component) function EthBalanceComponent () { @@ -50,8 +42,6 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { var splitBalance = value.split(' ') var ethNumber = splitBalance[0] var ethSuffix = splitBalance[1] - var fiatNumber = Number(splitBalance[0]) * state.conversionRate - var fiatSuffix = state.currentFiat if (state.shorten) { balance = balanceObj.shortBalance @@ -64,9 +54,7 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { return ( h(Tooltip, { position: 'bottom', - multiline: true, - title: `${ethNumber} ${ethSuffix} - ${fiatNumber} ${fiatSuffix}`, + title: `${ethNumber} ${ethSuffix}`, }, [ h('.flex-column', { style: { -- cgit v1.2.3 From 7d1b2db87e9d66735d0de04dc5e8c53e72e8431b Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 16 Aug 2016 10:48:31 -0700 Subject: linting and ignoring. --- ui/app/components/eth-balance.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index a5584a235..6c324c947 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') -- cgit v1.2.3 From 98dab0ffd2a3f30624fecbc6d6a2df5cdcf63bc1 Mon Sep 17 00:00:00 2001 From: Frankie Date: Thu, 18 Aug 2016 16:30:13 -0700 Subject: Make ballance teal for shapeshift tx and add to change log --- ui/app/components/eth-balance.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 6c324c947..bb2dc9010 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -21,10 +21,10 @@ EthBalanceComponent.prototype.render = function () { return ( - h('.ether-balance', { + h('.ether-balance.ether-balance-amount', { style: style, }, [ - h('.ether-balance-amount', { + h('div', { style: { display: 'inline', width: width, -- cgit v1.2.3 From edfb0eb96803e4f01a8d4880b44ad220ce4bbb9a Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 19 Aug 2016 17:18:11 -0700 Subject: Fix issue where if given a balance that does not need to be parsed will not be parsed --- ui/app/components/eth-balance.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ui/app/components/eth-balance.js') diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index bb2dc9010..498873faa 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -15,8 +15,8 @@ function EthBalanceComponent () { EthBalanceComponent.prototype.render = function () { var state = this.props var style = state.style - - const value = formatBalance(state.value, 6) + var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true + const value = formatBalance(state.value, 6, needsParse) var width = state.width return ( @@ -29,12 +29,13 @@ EthBalanceComponent.prototype.render = function () { display: 'inline', width: width, }, - }, this.renderBalance(value, state)), + }, this.renderBalance(value)), ]) ) } -EthBalanceComponent.prototype.renderBalance = function (value, state) { +EthBalanceComponent.prototype.renderBalance = function (value) { + var state = this.props if (value === 'None') return value var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) var balance @@ -68,7 +69,7 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { width: '100%', textAlign: 'right', }, - }, balance), + }, this.props.incoming ? `+${balance}` : balance), h('div', { style: { color: ' #AEAEAE', -- cgit v1.2.3