mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Show failed tx RPC error messages in tooltips
This changeset displays the error messages attached to txMeta for a failed tx in a tooltip on hover in the tx list view. This will only display for txs with the `txMeta.err.rpc.value` property, not all failed txs.
This commit is contained in:
parent
47b32682f3
commit
9662f9b8b5
@ -131,6 +131,11 @@ export default class TransactionListItem extends PureComponent {
|
|||||||
<TransactionStatus
|
<TransactionStatus
|
||||||
className="transaction-list-item__status"
|
className="transaction-list-item__status"
|
||||||
statusKey={transaction.status}
|
statusKey={transaction.status}
|
||||||
|
title={(
|
||||||
|
(transaction.err && transaction.err.rpc)
|
||||||
|
? transaction.err.rpc.message
|
||||||
|
: null
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
{ this.renderPrimaryCurrency() }
|
{ this.renderPrimaryCurrency() }
|
||||||
{ this.renderSecondaryCurrency() }
|
{ this.renderSecondaryCurrency() }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
import Tooltip from '../tooltip-v2'
|
||||||
import {
|
import {
|
||||||
UNAPPROVED_STATUS,
|
UNAPPROVED_STATUS,
|
||||||
REJECTED_STATUS,
|
REJECTED_STATUS,
|
||||||
@ -29,6 +30,10 @@ const statusToTextHash = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class TransactionStatus extends PureComponent {
|
export default class TransactionStatus extends PureComponent {
|
||||||
|
static defaultProps = {
|
||||||
|
title: null,
|
||||||
|
}
|
||||||
|
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
}
|
}
|
||||||
@ -36,15 +41,18 @@ export default class TransactionStatus extends PureComponent {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
statusKey: PropTypes.string,
|
statusKey: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { className, statusKey } = this.props
|
const { className, statusKey, title } = this.props
|
||||||
const statusText = this.context.t(statusToTextHash[statusKey] || statusKey)
|
const statusText = this.context.t(statusToTextHash[statusKey] || statusKey)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames('transaction-status', className, statusToClassNameHash[statusKey])}>
|
<div className={classnames('transaction-status', className, statusToClassNameHash[statusKey])}>
|
||||||
{ statusText }
|
<Tooltip position="top" title={title}>
|
||||||
|
{ statusText }
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user