diff options
Diffstat (limited to 'ui/app/components/transaction-action/transaction-action.component.js')
-rw-r--r-- | ui/app/components/transaction-action/transaction-action.component.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/app/components/transaction-action/transaction-action.component.js b/ui/app/components/transaction-action/transaction-action.component.js index 81a1e96d0..1de91cb71 100644 --- a/ui/app/components/transaction-action/transaction-action.component.js +++ b/ui/app/components/transaction-action/transaction-action.component.js @@ -1,10 +1,12 @@ import React, { PureComponent } from 'react' import PropTypes from 'prop-types' +import classnames from 'classnames' import { getTransactionActionKey } from '../../helpers/transactions.util' +import { camelCaseToCapitalize } from '../../helpers/common.util' export default class TransactionAction extends PureComponent { static contextTypes = { - tOrDefault: PropTypes.func, + t: PropTypes.func, } static propTypes = { @@ -29,13 +31,17 @@ export default class TransactionAction extends PureComponent { const { transactionAction } = this.state const { transaction, methodData } = this.props const { data, done } = methodData + const { name = '' } = data if (!done || transactionAction) { return } const actionKey = await getTransactionActionKey(transaction, data) - const action = actionKey && this.context.tOrDefault(actionKey) + const action = actionKey + ? this.context.t(actionKey) + : camelCaseToCapitalize(name) + this.setState({ transactionAction: action }) } @@ -44,7 +50,7 @@ export default class TransactionAction extends PureComponent { const { transactionAction } = this.state return ( - <div className={className}> + <div className={classnames('transaction-action', className)}> { (done && transactionAction) || '--' } </div> ) |