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') 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