mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Get fiat numbers rendering on tooltip. Need to find way to create line breaks.
This commit is contained in:
parent
be76b05726
commit
260de6532c
@ -293,12 +293,6 @@ ConfigManager.prototype.updateConversionRate = function () {
|
||||
const parsedResponse = JSON.parse(response)
|
||||
this.setConversionPrice(parsedResponse.ticker.price)
|
||||
this.setConversionDate(parsedResponse.timestamp)
|
||||
console.log('=================')
|
||||
console.log('Updated currency!')
|
||||
console.log('=================')
|
||||
console.log(this.getConversionRate())
|
||||
console.log(this.getCurrentFiat())
|
||||
console.log(parsedResponse)
|
||||
}).catch((err) => {
|
||||
console.error('Error in conversion.', err)
|
||||
})
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,8 @@
|
||||
{
|
||||
"metamask": {
|
||||
"currentFiat": "USD",
|
||||
"conversionRate": 11.06608791,
|
||||
"conversionDate": 1470421024,
|
||||
"isInitialized": true,
|
||||
"isUnlocked": true,
|
||||
"currentDomain": "example.com",
|
||||
|
@ -1,5 +1,8 @@
|
||||
{
|
||||
"metamask": {
|
||||
"currentFiat": "USD",
|
||||
"conversionRate": 11.06608791,
|
||||
"conversionDate": 1470421024,
|
||||
"isInitialized": true,
|
||||
"isUnlocked": true,
|
||||
"currentDomain": "example.com",
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"metamask": {
|
||||
"currentFiat": "JPY",
|
||||
"conversionRate": "N/A",
|
||||
"conversionDate": "N/A",
|
||||
"currentFiat": "USD",
|
||||
"conversionRate": 11.06608791,
|
||||
"conversionDate": 1470421024,
|
||||
"isInitialized": true,
|
||||
"isUnlocked": true,
|
||||
"currentDomain": "example.com",
|
||||
|
@ -20,6 +20,7 @@ module.exports = connect(mapStateToProps)(AccountDetailScreen)
|
||||
|
||||
function mapStateToProps (state) {
|
||||
return {
|
||||
metamask: state.metamask,
|
||||
identities: state.metamask.identities,
|
||||
accounts: state.metamask.accounts,
|
||||
address: state.metamask.selectedAccount,
|
||||
@ -250,4 +251,3 @@ AccountDetailScreen.prototype.transactionList = function () {
|
||||
AccountDetailScreen.prototype.requestAccountExport = function () {
|
||||
this.props.dispatch(actions.requestExportAccount())
|
||||
}
|
||||
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user