mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add retry transaction back into old ui transaction list item (#3381)
* Add retry transaction back into old ui transaction list item * Update Changelog
This commit is contained in:
parent
97dd993606
commit
cb109a8233
@ -3,6 +3,7 @@
|
|||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
- Ensure MetaMask's inpage provider is named MetamaskInpageProvider to keep some sites from breaking.
|
- Ensure MetaMask's inpage provider is named MetamaskInpageProvider to keep some sites from breaking.
|
||||||
|
- Add retry transaction button back into classic ui.
|
||||||
|
|
||||||
## 4.1.2 2018-2-28
|
## 4.1.2 2018-2-28
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const Component = require('react').Component
|
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 connect = require('react-redux').connect
|
||||||
|
|
||||||
const EthBalance = require('./eth-balance')
|
const EthBalance = require('./eth-balance')
|
||||||
const addressSummary = require('../util').addressSummary
|
const addressSummary = require('../util').addressSummary
|
||||||
@ -9,18 +10,33 @@ const CopyButton = require('./copyButton')
|
|||||||
const vreme = new (require('vreme'))()
|
const vreme = new (require('vreme'))()
|
||||||
const Tooltip = require('./tooltip')
|
const Tooltip = require('./tooltip')
|
||||||
const numberToBN = require('number-to-bn')
|
const numberToBN = require('number-to-bn')
|
||||||
|
const actions = require('../../../ui/app/actions')
|
||||||
|
|
||||||
const TransactionIcon = require('./transaction-list-item-icon')
|
const TransactionIcon = require('./transaction-list-item-icon')
|
||||||
const ShiftListItem = require('./shift-list-item')
|
const ShiftListItem = require('./shift-list-item')
|
||||||
module.exports = TransactionListItem
|
|
||||||
|
const mapDispatchToProps = dispatch => {
|
||||||
|
return {
|
||||||
|
retryTransaction: transactionId => dispatch(actions.retryTransaction(transactionId)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = connect(null, mapDispatchToProps)(TransactionListItem)
|
||||||
|
|
||||||
inherits(TransactionListItem, Component)
|
inherits(TransactionListItem, Component)
|
||||||
function TransactionListItem () {
|
function TransactionListItem () {
|
||||||
Component.call(this)
|
Component.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionListItem.prototype.showRetryButton = function () {
|
||||||
|
const { transaction = {} } = this.props
|
||||||
|
const { status, time } = transaction
|
||||||
|
return status === 'submitted' && Date.now() - time > 30000
|
||||||
|
}
|
||||||
|
|
||||||
TransactionListItem.prototype.render = function () {
|
TransactionListItem.prototype.render = function () {
|
||||||
const { transaction, network, conversionRate, currentCurrency } = this.props
|
const { transaction, network, conversionRate, currentCurrency } = this.props
|
||||||
|
const { status } = transaction
|
||||||
if (transaction.key === 'shapeshift') {
|
if (transaction.key === 'shapeshift') {
|
||||||
if (network === '1') return h(ShiftListItem, transaction)
|
if (network === '1') return h(ShiftListItem, transaction)
|
||||||
}
|
}
|
||||||
@ -32,7 +48,7 @@ TransactionListItem.prototype.render = function () {
|
|||||||
|
|
||||||
var isMsg = ('msgParams' in transaction)
|
var isMsg = ('msgParams' in transaction)
|
||||||
var isTx = ('txParams' in transaction)
|
var isTx = ('txParams' in transaction)
|
||||||
var isPending = transaction.status === 'unapproved'
|
var isPending = status === 'unapproved'
|
||||||
let txParams
|
let txParams
|
||||||
if (isTx) {
|
if (isTx) {
|
||||||
txParams = transaction.txParams
|
txParams = transaction.txParams
|
||||||
@ -44,7 +60,7 @@ TransactionListItem.prototype.render = function () {
|
|||||||
|
|
||||||
const isClickable = ('hash' in transaction && isLinkable) || isPending
|
const isClickable = ('hash' in transaction && isLinkable) || isPending
|
||||||
return (
|
return (
|
||||||
h(`.transaction-list-item.flex-row.flex-space-between${isClickable ? '.pointer' : ''}`, {
|
h('.transaction-list-item.flex-column', {
|
||||||
onClick: (event) => {
|
onClick: (event) => {
|
||||||
if (isPending) {
|
if (isPending) {
|
||||||
this.props.showTx(transaction.id)
|
this.props.showTx(transaction.id)
|
||||||
@ -56,51 +72,92 @@ TransactionListItem.prototype.render = function () {
|
|||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
padding: '20px 0',
|
padding: '20px 0',
|
||||||
display: 'flex',
|
alignItems: 'center',
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
},
|
||||||
}, [
|
}, [
|
||||||
|
h(`.flex-row.flex-space-between${isClickable ? '.pointer' : ''}`, {
|
||||||
h('.identicon-wrapper.flex-column.flex-center.select-none', [
|
style: {
|
||||||
h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
|
width: '100%',
|
||||||
]),
|
},
|
||||||
|
|
||||||
h(Tooltip, {
|
|
||||||
title: 'Transaction Number',
|
|
||||||
position: 'right',
|
|
||||||
}, [
|
}, [
|
||||||
h('span', {
|
h('.identicon-wrapper.flex-column.flex-center.select-none', [
|
||||||
|
h(TransactionIcon, { txParams, transaction, isTx, isMsg }),
|
||||||
|
]),
|
||||||
|
|
||||||
|
h(Tooltip, {
|
||||||
|
title: 'Transaction Number',
|
||||||
|
position: 'right',
|
||||||
|
}, [
|
||||||
|
h('span', {
|
||||||
|
style: {
|
||||||
|
display: 'flex',
|
||||||
|
cursor: 'normal',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
padding: '10px',
|
||||||
|
},
|
||||||
|
}, nonce),
|
||||||
|
]),
|
||||||
|
|
||||||
|
h('.flex-column', {style: {width: '200px', overflow: 'hidden'}}, [
|
||||||
|
domainField(txParams),
|
||||||
|
h('div', date),
|
||||||
|
recipientField(txParams, transaction, isTx, isMsg),
|
||||||
|
]),
|
||||||
|
|
||||||
|
// Places a copy button if tx is successful, else places a placeholder empty div.
|
||||||
|
transaction.hash ? h(CopyButton, { value: transaction.hash }) : h('div', {style: { display: 'flex', alignItems: 'center', width: '26px' }}),
|
||||||
|
|
||||||
|
isTx ? h(EthBalance, {
|
||||||
|
value: txParams.value,
|
||||||
|
conversionRate,
|
||||||
|
currentCurrency,
|
||||||
|
width: '55px',
|
||||||
|
shorten: true,
|
||||||
|
showFiat: false,
|
||||||
|
style: {fontSize: '15px'},
|
||||||
|
}) : h('.flex-column'),
|
||||||
|
]),
|
||||||
|
|
||||||
|
this.showRetryButton() && h('.transition-list-item__retry.grow-on-hover', {
|
||||||
|
onClick: event => {
|
||||||
|
event.stopPropagation()
|
||||||
|
this.resubmit()
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
height: '22px',
|
||||||
|
borderRadius: '22px',
|
||||||
|
color: '#F9881B',
|
||||||
|
padding: '0 20px',
|
||||||
|
backgroundColor: '#FFE3C9',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
fontSize: '8px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
h('div', {
|
||||||
style: {
|
style: {
|
||||||
display: 'flex',
|
paddingRight: '2px',
|
||||||
cursor: 'normal',
|
|
||||||
flexDirection: 'column',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'center',
|
|
||||||
},
|
},
|
||||||
}, nonce),
|
}, 'Taking too long?'),
|
||||||
|
h('div', {
|
||||||
|
style: {
|
||||||
|
textDecoration: 'underline',
|
||||||
|
},
|
||||||
|
}, 'Retry with a higher gas price here'),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
h('.flex-column', {style: {width: '150px', overflow: 'hidden'}}, [
|
|
||||||
domainField(txParams),
|
|
||||||
h('div', date),
|
|
||||||
recipientField(txParams, transaction, isTx, isMsg),
|
|
||||||
]),
|
|
||||||
|
|
||||||
// Places a copy button if tx is successful, else places a placeholder empty div.
|
|
||||||
transaction.hash ? h(CopyButton, { value: transaction.hash }) : h('div', {style: { display: 'flex', alignItems: 'center', width: '26px' }}),
|
|
||||||
|
|
||||||
isTx ? h(EthBalance, {
|
|
||||||
value: txParams.value,
|
|
||||||
conversionRate,
|
|
||||||
currentCurrency,
|
|
||||||
shorten: true,
|
|
||||||
showFiat: false,
|
|
||||||
style: {fontSize: '15px'},
|
|
||||||
}) : h('.flex-column'),
|
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionListItem.prototype.resubmit = function () {
|
||||||
|
const { transaction } = this.props
|
||||||
|
this.props.retryTransaction(transaction.id)
|
||||||
|
}
|
||||||
|
|
||||||
function domainField (txParams) {
|
function domainField (txParams) {
|
||||||
return h('div', {
|
return h('div', {
|
||||||
style: {
|
style: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user