From 4931381e0e8f811bd98686ac58a0ba26326229a3 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 8 Nov 2016 16:55:11 +0100 Subject: [PATCH] txHash component: add maxConfirmations prop --- js/src/ui/TxHash/txHash.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/src/ui/TxHash/txHash.js b/js/src/ui/TxHash/txHash.js index 5af000499..87d1850f7 100644 --- a/js/src/ui/TxHash/txHash.js +++ b/js/src/ui/TxHash/txHash.js @@ -31,9 +31,14 @@ class TxHash extends Component { static propTypes = { hash: PropTypes.string.isRequired, isTest: PropTypes.bool, - summary: PropTypes.bool + summary: PropTypes.bool, + maxConfirmations: PropTypes.number } + static defaultProps = { + maxConfirmations: 10 + }; + state = { blockNumber: new BigNumber(0), transaction: null, @@ -79,6 +84,7 @@ class TxHash extends Component { } renderConfirmations () { + const { maxConfirmations } = this.props; const { blockNumber, transaction } = this.state; let txBlock = 'Pending'; @@ -89,14 +95,14 @@ class TxHash extends Component { const num = blockNumber.minus(transaction.blockNumber).plus(1); txBlock = `#${transaction.blockNumber.toFormat(0)}`; confirmations = num.toFormat(0); - value = num.gt(10) ? 10 : num.toNumber(); + value = num.gt(maxConfirmations) ? maxConfirmations : num.toNumber(); } return (