Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2381 from LiskHQ/2253-fix-recent-transactions-on-…
…dashboard Fix recent transactions on dashboard - Closes #2253
- Loading branch information
Showing
6 changed files
with
65 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import transactionTypes from '../../../constants/transactionTypes'; | ||
import LiskAmount from '../../liskAmount'; | ||
import styles from './transactionAmount.css'; | ||
import transactionTypes from '../../../constants/transactionTypes'; | ||
|
||
const TransactionAmount = ({ address, transaction, token }) => { | ||
const getTransactionType = () => { | ||
if (address === transaction.recipientId) { | ||
return ( | ||
<span className={styles.recieve}> | ||
<LiskAmount val={transaction.amount} /> | ||
{' '} | ||
{token} | ||
</span> | ||
); | ||
} | ||
|
||
return ( | ||
<span> | ||
{'- '} | ||
<LiskAmount val={transaction.amount} /> | ||
{' '} | ||
{token} | ||
</span> | ||
); | ||
}; | ||
|
||
const TransactionAmount = ({ | ||
address, transaction, token, roundTo, | ||
}) => { | ||
const isRecieve = address === transaction.recipientId; | ||
return ( | ||
<div className={`${styles.wrapper} transaction-amount`}> | ||
{ | ||
transaction.type === transactionTypes.send | ||
? getTransactionType() | ||
{ transaction.type === transactionTypes.send | ||
? ( | ||
<span className={isRecieve ? styles.recieve : ''}> | ||
{isRecieve ? '' : '- '} | ||
<LiskAmount val={transaction.amount} roundTo={roundTo} /> | ||
{' '} | ||
{token} | ||
</span> | ||
) | ||
: '-' | ||
} | ||
} | ||
</div> | ||
); | ||
}; | ||
|
||
TransactionAmount.propTypes = { | ||
address: PropTypes.string.isRequired, | ||
token: PropTypes.string.isRequired, | ||
transaction: PropTypes.shape({ | ||
type: PropTypes.number.isRequired, | ||
amount: PropTypes.string.isRequired, | ||
recipientId: PropTypes.string.isRequired, | ||
}), | ||
roundTo: PropTypes.number, | ||
}; | ||
|
||
TransactionAmount.defaultProps = { | ||
roundTo: 8, | ||
}; | ||
|
||
export default TransactionAmount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters