diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-08-28 06:02:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 06:02:07 +0800 |
commit | 4b17ec67ecd7c16b942fc49aedb8e53732adbb96 (patch) | |
tree | a75112b245f8ad7677cd2be425b13738e0e2f869 /ui/app/components/transaction-status/transaction-status.component.js | |
parent | 30e49b8545a33faf2f1d1451c9135c996a6816b0 (diff) | |
parent | 952edf695c167385e9d864c45bd889219c456e78 (diff) | |
download | tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.gz tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.bz2 tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.lz tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.xz tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.tar.zst tangerine-wallet-browser-4b17ec67ecd7c16b942fc49aedb8e53732adbb96.zip |
Merge pull request #4919 from MetaMask/refactor-tx-list
Refactor and Redesign Transaction List
Diffstat (limited to 'ui/app/components/transaction-status/transaction-status.component.js')
-rw-r--r-- | ui/app/components/transaction-status/transaction-status.component.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ui/app/components/transaction-status/transaction-status.component.js b/ui/app/components/transaction-status/transaction-status.component.js new file mode 100644 index 000000000..a4c827ae8 --- /dev/null +++ b/ui/app/components/transaction-status/transaction-status.component.js @@ -0,0 +1,51 @@ +import React, { PureComponent } from 'react' +import PropTypes from 'prop-types' +import classnames from 'classnames' +import { + UNAPPROVED_STATUS, + REJECTED_STATUS, + APPROVED_STATUS, + SIGNED_STATUS, + SUBMITTED_STATUS, + CONFIRMED_STATUS, + FAILED_STATUS, + DROPPED_STATUS, +} from '../../constants/transactions' + +const statusToClassNameHash = { + [UNAPPROVED_STATUS]: 'transaction-status--unapproved', + [REJECTED_STATUS]: 'transaction-status--rejected', + [APPROVED_STATUS]: 'transaction-status--approved', + [SIGNED_STATUS]: 'transaction-status--signed', + [SUBMITTED_STATUS]: 'transaction-status--submitted', + [CONFIRMED_STATUS]: 'transaction-status--confirmed', + [FAILED_STATUS]: 'transaction-status--failed', + [DROPPED_STATUS]: 'transaction-status--dropped', +} + +const statusToTextHash = { + [APPROVED_STATUS]: 'pending', + [SUBMITTED_STATUS]: 'pending', +} + +export default class TransactionStatus extends PureComponent { + static contextTypes = { + t: PropTypes.func, + } + + static propTypes = { + statusKey: PropTypes.string, + className: PropTypes.string, + } + + render () { + const { className, statusKey } = this.props + const statusText = this.context.t(statusToTextHash[statusKey] || statusKey) + + return ( + <div className={classnames('transaction-status', className, statusToClassNameHash[statusKey])}> + { statusText } + </div> + ) + } +} |