mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Styles and behaviour correct
This commit is contained in:
parent
b785beb546
commit
0a44c82458
@ -12,7 +12,7 @@ function FiatValue () {
|
|||||||
|
|
||||||
FiatValue.prototype.render = function () {
|
FiatValue.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const { conversionRate, currentCurrency } = props
|
const { conversionRate, currentCurrency, style } = props
|
||||||
|
|
||||||
const value = formatBalance(props.value, 6)
|
const value = formatBalance(props.value, 6)
|
||||||
|
|
||||||
@ -28,16 +28,18 @@ FiatValue.prototype.render = function () {
|
|||||||
fiatTooltipNumber = 'Unknown'
|
fiatTooltipNumber = 'Unknown'
|
||||||
}
|
}
|
||||||
|
|
||||||
return fiatDisplay(fiatDisplayNumber, currentCurrency)
|
return fiatDisplay(fiatDisplayNumber, currentCurrency, style)
|
||||||
}
|
}
|
||||||
|
|
||||||
function fiatDisplay (fiatDisplayNumber, fiatSuffix) {
|
function fiatDisplay (fiatDisplayNumber, fiatSuffix, styleOveride = {}) {
|
||||||
|
const { fontSize, color, fontFamily, lineHeight } = styleOveride
|
||||||
|
|
||||||
if (fiatDisplayNumber !== 'N/A') {
|
if (fiatDisplayNumber !== 'N/A') {
|
||||||
return h('.flex-row', {
|
return h('.flex-row', {
|
||||||
style: {
|
style: {
|
||||||
alignItems: 'flex-end',
|
alignItems: 'flex-end',
|
||||||
lineHeight: '13px',
|
lineHeight: lineHeight || '13px',
|
||||||
fontFamily: 'Montserrat Light',
|
fontFamily: fontFamily || 'Montserrat Light',
|
||||||
textRendering: 'geometricPrecision',
|
textRendering: 'geometricPrecision',
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
@ -45,15 +47,15 @@ function fiatDisplay (fiatDisplayNumber, fiatSuffix) {
|
|||||||
style: {
|
style: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
fontSize: '12px',
|
fontSize: fontSize || '12px',
|
||||||
color: '#333333',
|
color: color || '#333333',
|
||||||
},
|
},
|
||||||
}, fiatDisplayNumber),
|
}, fiatDisplayNumber),
|
||||||
h('div', {
|
h('div', {
|
||||||
style: {
|
style: {
|
||||||
color: '#AEAEAE',
|
color: color || '#AEAEAE',
|
||||||
marginLeft: '5px',
|
marginLeft: '5px',
|
||||||
fontSize: '12px',
|
fontSize: fontSize || '12px',
|
||||||
},
|
},
|
||||||
}, fiatSuffix),
|
}, fiatSuffix),
|
||||||
])
|
])
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: $scorpion;
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-screen-amount-labels {
|
.send-screen-amount-labels {
|
||||||
@ -79,8 +81,6 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-screen-bolt-icon {}
|
|
||||||
|
|
||||||
.selected-currency {
|
.selected-currency {
|
||||||
color: $curious-blue;
|
color: $curious-blue;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ $curious-blue: #2f9ae0;
|
|||||||
$concrete: #f3f3f3;
|
$concrete: #f3f3f3;
|
||||||
$tundora: #4d4d4d;
|
$tundora: #4d4d4d;
|
||||||
$nile-blue: #1b344d;
|
$nile-blue: #1b344d;
|
||||||
|
$scorpion: #5d5d5d;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Z-Indicies
|
Z-Indicies
|
||||||
|
@ -5,13 +5,15 @@ const connect = require('react-redux').connect
|
|||||||
const Identicon = require('./components/identicon')
|
const Identicon = require('./components/identicon')
|
||||||
const actions = require('./actions')
|
const actions = require('./actions')
|
||||||
const util = require('./util')
|
const util = require('./util')
|
||||||
|
const ethUtil = require('ethereumjs-util')
|
||||||
|
const BN = ethUtil.BN
|
||||||
|
const hexToBn = require('../../app/scripts/lib/hex-to-bn')
|
||||||
const numericBalance = require('./util').numericBalance
|
const numericBalance = require('./util').numericBalance
|
||||||
const addressSummary = require('./util').addressSummary
|
const addressSummary = require('./util').addressSummary
|
||||||
const isHex = require('./util').isHex
|
const isHex = require('./util').isHex
|
||||||
const EthBalance = require('./components/eth-balance')
|
const EthBalance = require('./components/eth-balance')
|
||||||
const EnsInput = require('./components/ens-input')
|
const EnsInput = require('./components/ens-input')
|
||||||
const FiatValue = require('./components/fiat-value.js')
|
const FiatValue = require('./components/fiat-value.js')
|
||||||
const ethUtil = require('ethereumjs-util')
|
|
||||||
const GasTooltip = require('./components/gas-tooltip.js')
|
const GasTooltip = require('./components/gas-tooltip.js')
|
||||||
const { getSelectedIdentity } = require('./selectors')
|
const { getSelectedIdentity } = require('./selectors')
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ function mapStateToProps (state) {
|
|||||||
addressBook: state.metamask.addressBook,
|
addressBook: state.metamask.addressBook,
|
||||||
conversionRate: state.metamask.conversionRate,
|
conversionRate: state.metamask.conversionRate,
|
||||||
currentCurrency: state.metamask.currentCurrency,
|
currentCurrency: state.metamask.currentCurrency,
|
||||||
|
blockGasLimit: state.metamask.currentBlockGasLimit,
|
||||||
}
|
}
|
||||||
|
|
||||||
result.error = result.warning && result.warning.split('.')[0]
|
result.error = result.warning && result.warning.split('.')[0]
|
||||||
@ -53,9 +56,9 @@ function SendTransactionScreen () {
|
|||||||
to: '',
|
to: '',
|
||||||
// these values are hardcoded, so "Next" can be clicked
|
// these values are hardcoded, so "Next" can be clicked
|
||||||
amount: '0.0001', // see L544
|
amount: '0.0001', // see L544
|
||||||
gasPrice: '4a817c800',
|
gasPrice: '0x19',
|
||||||
gas: '0x7b0d',
|
gas: '0x7b0d',
|
||||||
gasFee: ((parseInt('0x7b0d', 16) * parseInt('4a817c800', 16)) / 1000000000).toFixed(10),
|
gasFee: ((parseInt('0x7b0d', 16) * parseInt('0x19', 16)) / 1000000000).toFixed(6),
|
||||||
txData: null,
|
txData: null,
|
||||||
memo: '',
|
memo: '',
|
||||||
},
|
},
|
||||||
@ -63,6 +66,28 @@ function SendTransactionScreen () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendTransactionScreen.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {
|
||||||
|
const numBN = new BN(numerator)
|
||||||
|
const denomBN = new BN(denominator)
|
||||||
|
return targetBN.mul(numBN).div(denomBN)
|
||||||
|
}
|
||||||
|
|
||||||
|
SendTransactionScreen.prototype.getTxFeeBn = function (gas, gasPrice = MIN_GAS_PRICE_BN.toString(16)) {
|
||||||
|
const { blockGasLimit } = this.props;
|
||||||
|
const gasBn = hexToBn(gas)
|
||||||
|
const gasLimit = new BN(parseInt(blockGasLimit))
|
||||||
|
const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
|
||||||
|
|
||||||
|
|
||||||
|
// Gas Price
|
||||||
|
const gasPriceBn = hexToBn(gasPrice)
|
||||||
|
const txFeeBn = gasBn.mul(gasPriceBn)
|
||||||
|
|
||||||
|
const fiatMultiplier = hexToBn((1000000000).toString(16))
|
||||||
|
const txFeeAsFiatBn = txFeeBn.mul(fiatMultiplier)
|
||||||
|
return txFeeAsFiatBn;
|
||||||
|
}
|
||||||
|
|
||||||
SendTransactionScreen.prototype.render = function () {
|
SendTransactionScreen.prototype.render = function () {
|
||||||
this.persistentFormParentId = 'send-tx-form'
|
this.persistentFormParentId = 'send-tx-form'
|
||||||
|
|
||||||
@ -226,10 +251,21 @@ SendTransactionScreen.prototype.render = function () {
|
|||||||
h('span', {}, ['What\'s this?']),
|
h('span', {}, ['What\'s this?']),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
// TODO: handle loading time when switching to USD
|
||||||
h('div.large-input.send-screen-gas-input', {}, [
|
h('div.large-input.send-screen-gas-input', {}, [
|
||||||
h(FiatValue, {
|
currentCurrency === 'USD'
|
||||||
value: this.state.newTx.gasFee.toString(16), conversionRate, currentCurrency }
|
? h(FiatValue, {
|
||||||
),
|
value: this.getTxFeeBn.bind(this)(this.state.newTx.gas.toString(16), this.state.newTx.gasPrice.toString(16)).toString(16),
|
||||||
|
conversionRate,
|
||||||
|
currentCurrency,
|
||||||
|
style: {
|
||||||
|
color: '#5d5d5d',
|
||||||
|
fontSize: '16px',
|
||||||
|
fontFamily: 'DIN OT',
|
||||||
|
lineHeight: '22.4px'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: h('div', {}, [`${this.state.newTx.gasFee} ETH`]),
|
||||||
h('div.send-screen-gas-input-customize', {
|
h('div.send-screen-gas-input-customize', {
|
||||||
onClick: () => this.setTooltipOpen.bind(this)(!this.state.tooltipIsOpen),
|
onClick: () => this.setTooltipOpen.bind(this)(!this.state.tooltipIsOpen),
|
||||||
}, [
|
}, [
|
||||||
@ -248,7 +284,8 @@ SendTransactionScreen.prototype.render = function () {
|
|||||||
newTx: Object.assign(
|
newTx: Object.assign(
|
||||||
this.state.newTx,
|
this.state.newTx,
|
||||||
{
|
{
|
||||||
gasFee: ((gasLimit * gasPrice) / 1000000000).toFixed(10),
|
// TODO: determine how prices are rounded on master
|
||||||
|
gasFee: ((gasPrice / 1000000000) * gasLimit).toFixed(6),
|
||||||
gas: gasLimit,
|
gas: gasLimit,
|
||||||
gasPrice,
|
gasPrice,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user