diff options
author | Dan J Miller <danjm.com@gmail.com> | 2019-08-17 02:54:10 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-08-17 02:54:10 +0800 |
commit | 821529622e4baf095dc34c309b878d09f945da9b (patch) | |
tree | 2d68d862cd7e24c3e0b9fcf56046e01ec546d521 /ui/app/components | |
parent | 2f5d7ac8c304260bf9f6aef487140c04741bd17c (diff) | |
download | tangerine-wallet-browser-821529622e4baf095dc34c309b878d09f945da9b.tar.gz tangerine-wallet-browser-821529622e4baf095dc34c309b878d09f945da9b.tar.zst tangerine-wallet-browser-821529622e4baf095dc34c309b878d09f945da9b.zip |
Fetch & display received transactions (#6996)
Diffstat (limited to 'ui/app/components')
3 files changed, 37 insertions, 13 deletions
diff --git a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js index 8bdb6a313..f4f8d97b2 100644 --- a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js +++ b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js @@ -36,6 +36,7 @@ export default class TransactionListItem extends PureComponent { rpcPrefs: PropTypes.object, data: PropTypes.string, getContractMethodData: PropTypes.func, + isDeposit: PropTypes.bool, } static defaultProps = { @@ -117,7 +118,7 @@ export default class TransactionListItem extends PureComponent { } renderPrimaryCurrency () { - const { token, primaryTransaction: { txParams: { data } = {} } = {}, value } = this.props + const { token, primaryTransaction: { txParams: { data } = {} } = {}, value, isDeposit } = this.props return token ? ( @@ -132,7 +133,7 @@ export default class TransactionListItem extends PureComponent { className="transaction-list-item__amount transaction-list-item__amount--primary" value={value} type={PRIMARY} - prefix="-" + prefix={isDeposit ? '' : '-'} /> ) } diff --git a/ui/app/components/app/transaction-list-item/transaction-list-item.container.js b/ui/app/components/app/transaction-list-item/transaction-list-item.container.js index 1675958aa..27b9e2608 100644 --- a/ui/app/components/app/transaction-list-item/transaction-list-item.container.js +++ b/ui/app/components/app/transaction-list-item/transaction-list-item.container.js @@ -21,8 +21,10 @@ const mapStateToProps = (state, ownProps) => { const { showFiatInTestnets } = preferencesSelector(state) const isMainnet = getIsMainnet(state) const { transactionGroup: { primaryTransaction } = {} } = ownProps - const { txParams: { gas: gasLimit, gasPrice, data } = {} } = primaryTransaction - const selectedAccountBalance = accounts[getSelectedAddress(state)].balance + const { txParams: { gas: gasLimit, gasPrice, data, to } = {} } = primaryTransaction + const selectedAddress = getSelectedAddress(state) + const selectedAccountBalance = accounts[selectedAddress].balance + const isDeposit = selectedAddress === to const selectRpcInfo = frequentRpcListDetail.find(rpcInfo => rpcInfo.rpcUrl === provider.rpcTarget) const { rpcPrefs } = selectRpcInfo || {} @@ -42,6 +44,7 @@ const mapStateToProps = (state, ownProps) => { selectedAccountBalance, hasEnoughCancelGas, rpcPrefs, + isDeposit, } } @@ -68,12 +71,13 @@ const mapDispatchToProps = dispatch => { const mergeProps = (stateProps, dispatchProps, ownProps) => { const { transactionGroup: { primaryTransaction, initialTransaction } = {} } = ownProps + const { isDeposit } = stateProps const { retryTransaction, ...restDispatchProps } = dispatchProps - const { txParams: { nonce, data } = {}, time } = initialTransaction + const { txParams: { nonce, data } = {}, time = 0 } = initialTransaction const { txParams: { value } = {} } = primaryTransaction const tokenData = data && getTokenData(data) - const nonceAndDate = nonce ? `#${hexToDecimal(nonce)} - ${formatDate(time)}` : formatDate(time) + const nonceAndDate = nonce && !isDeposit ? `#${hexToDecimal(nonce)} - ${formatDate(time)}` : formatDate(time) return { ...stateProps, diff --git a/ui/app/components/app/transaction-list/index.scss b/ui/app/components/app/transaction-list/index.scss index 42eddd31e..7535137e2 100644 --- a/ui/app/components/app/transaction-list/index.scss +++ b/ui/app/components/app/transaction-list/index.scss @@ -11,15 +11,34 @@ } &__header { - flex: 0 0 auto; - font-size: 14px; - line-height: 20px; - color: $Grey-400; border-bottom: 1px solid $Grey-100; - padding: 8px 0 8px 20px; - @media screen and (max-width: $break-small) { - padding: 8px 0 8px 16px; + &__tabs { + display: flex; + } + + &__tab, + &__tab--selected { + flex: 0 0 auto; + font-size: 14px; + line-height: 20px; + color: $Grey-400; + padding: 8px 0 8px 20px; + cursor: pointer; + + &:hover { + font-weight: bold; + } + + @media screen and (max-width: $break-small) { + padding: 8px 0 8px 16px; + } + } + + &__tab--selected { + font-weight: bold; + color: $Blue-400; + cursor: auto; } } |