mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #418 from MetaMask/ui-fixth-width-tx-history
Fixed width applied on transaction history components
This commit is contained in:
commit
5bb075a278
@ -8,6 +8,7 @@
|
|||||||
- Fix issue where dropdowns were not in front of icons.
|
- Fix issue where dropdowns were not in front of icons.
|
||||||
- Update transaction approval styles.
|
- Update transaction approval styles.
|
||||||
- Align failed and successful transaction history text.
|
- Align failed and successful transaction history text.
|
||||||
|
- Fix issue where large domain names and large transaction values would misalign the transaction history.
|
||||||
|
|
||||||
## 2.5.0 2016-06-29
|
## 2.5.0 2016-06-29
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -58,8 +58,8 @@
|
|||||||
"txParams": {
|
"txParams": {
|
||||||
"from": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
"from": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||||
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
|
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
|
||||||
"value": "0xde0b6b3a7640000",
|
"value": "0x66c899104aa57038000",
|
||||||
"origin": "testfaucet.metamask.io",
|
"origin": "thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com",
|
||||||
"metamaskId": 1467921503489592,
|
"metamaskId": 1467921503489592,
|
||||||
"metamaskNetworkId": "2"
|
"metamaskNetworkId": "2"
|
||||||
},
|
},
|
||||||
@ -72,8 +72,8 @@
|
|||||||
"txParams": {
|
"txParams": {
|
||||||
"from": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
"from": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc",
|
||||||
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
|
"to": "0x18a3462427bcc9133bb46e88bcbe39cd7ef0e761",
|
||||||
"value": "0xde0b6b3a7640000",
|
"value": "0x99966c8104aa57038000",
|
||||||
"origin": "testfaucet.metamask.io",
|
"origin": "thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com",
|
||||||
"metamaskId": 1467923203344608,
|
"metamaskId": 1467923203344608,
|
||||||
"metamaskNetworkId": "2"
|
"metamaskNetworkId": "2"
|
||||||
},
|
},
|
||||||
|
87
ui/app/components/eth-balance-tx-history.js
Normal file
87
ui/app/components/eth-balance-tx-history.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
const Component = require('react').Component
|
||||||
|
const h = require('react-hyperscript')
|
||||||
|
const inherits = require('util').inherits
|
||||||
|
const formatBalance = require('../util').formatBalance
|
||||||
|
const generateBalanceObject = require('../util').generateBalanceObject
|
||||||
|
const Tooltip = require('./tooltip.js')
|
||||||
|
module.exports = EthBalanceComponent
|
||||||
|
|
||||||
|
inherits(EthBalanceComponent, Component)
|
||||||
|
function EthBalanceComponent () {
|
||||||
|
Component.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
EthBalanceComponent.prototype.render = function () {
|
||||||
|
var state = this.props
|
||||||
|
var style = state.style
|
||||||
|
var value = formatBalance(state.value)
|
||||||
|
var maxWidth = state.maxWidth
|
||||||
|
return (
|
||||||
|
|
||||||
|
h('.ether-balance', {
|
||||||
|
style: style,
|
||||||
|
}, [
|
||||||
|
h('.ether-balance-amount', {
|
||||||
|
style: {
|
||||||
|
display: 'inline',
|
||||||
|
maxWidth: maxWidth,
|
||||||
|
},
|
||||||
|
}, this.renderBalance(value, state)),
|
||||||
|
])
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
EthBalanceComponent.prototype.renderBalance = function (value, state) {
|
||||||
|
if (value === 'None') return value
|
||||||
|
var balanceObj = generateBalanceObject(value)
|
||||||
|
|
||||||
|
var balance = balanceObj.balance
|
||||||
|
|
||||||
|
if (state.shorten) {
|
||||||
|
balance = shortenBalance(balance)
|
||||||
|
}
|
||||||
|
|
||||||
|
var label = balanceObj.label
|
||||||
|
|
||||||
|
return (
|
||||||
|
h(Tooltip, {
|
||||||
|
position: 'bottom',
|
||||||
|
title: value.split(' ')[0],
|
||||||
|
}, [
|
||||||
|
h('.flex-column', {
|
||||||
|
style: {
|
||||||
|
alignItems: 'flex-end',
|
||||||
|
lineHeight: '13px',
|
||||||
|
fontFamily: 'Montserrat Light',
|
||||||
|
textRendering: 'geometricPrecision',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
}, balance),
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
color: ' #AEAEAE',
|
||||||
|
fontSize: '12px',
|
||||||
|
},
|
||||||
|
}, label),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function shortenBalance (balance) {
|
||||||
|
var truncatedValue
|
||||||
|
var convertedBalance = parseFloat(balance)
|
||||||
|
if (convertedBalance > 1000000) {
|
||||||
|
truncatedValue = (balance / 1000000).toFixed(1)
|
||||||
|
return `${truncatedValue}m`
|
||||||
|
} else if (convertedBalance > 1000) {
|
||||||
|
truncatedValue = (balance / 1000).toFixed(1)
|
||||||
|
return `${truncatedValue}k`
|
||||||
|
} else {
|
||||||
|
return balance
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ const Component = require('react').Component
|
|||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
|
|
||||||
const EtherBalance = require('./eth-balance')
|
const EtherBalance = require('./eth-balance-tx-history')
|
||||||
const addressSummary = require('../util').addressSummary
|
const addressSummary = require('../util').addressSummary
|
||||||
const explorerLink = require('../../lib/explorer-link')
|
const explorerLink = require('../../lib/explorer-link')
|
||||||
const CopyButton = require('./copyButton')
|
const CopyButton = require('./copyButton')
|
||||||
@ -62,7 +62,7 @@ TransactionListItem.prototype.render = function () {
|
|||||||
: h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
|
: h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
h('.flex-column', [
|
h('.flex-column', {style: {width: '200px', overflow: 'hidden'}}, [
|
||||||
domainField(txParams),
|
domainField(txParams),
|
||||||
h('div', date),
|
h('div', date),
|
||||||
recipientField(txParams, transaction, isTx, isMsg),
|
recipientField(txParams, transaction, isTx, isMsg),
|
||||||
@ -73,6 +73,8 @@ TransactionListItem.prototype.render = function () {
|
|||||||
|
|
||||||
isTx ? h(EtherBalance, {
|
isTx ? h(EtherBalance, {
|
||||||
value: txParams.value,
|
value: txParams.value,
|
||||||
|
maxWidth: '55px',
|
||||||
|
shorten: true,
|
||||||
}) : h('.flex-column'),
|
}) : h('.flex-column'),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
@ -83,6 +85,9 @@ function domainField (txParams) {
|
|||||||
style: {
|
style: {
|
||||||
fontSize: 'x-small',
|
fontSize: 'x-small',
|
||||||
color: '#ABA9AA',
|
color: '#ABA9AA',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
width: '100%',
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
txParams.origin,
|
txParams.origin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user