aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/tx-view.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-09-07 14:03:23 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-09-07 14:03:23 +0800
commit14b2f3e391752cca02c05ae0137e490bfdcdd7a7 (patch)
treed23f6397e4b21bcb3f3c009d722fa666fab79b10 /ui/app/components/tx-view.js
parentf1fb9e10a06d1811d97f61b6369684979b7ecf70 (diff)
downloadtangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar.gz
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar.bz2
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar.lz
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar.xz
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.tar.zst
tangerine-wallet-browser-14b2f3e391752cca02c05ae0137e490bfdcdd7a7.zip
Show token balance and identicon
Diffstat (limited to 'ui/app/components/tx-view.js')
-rw-r--r--ui/app/components/tx-view.js73
1 files changed, 44 insertions, 29 deletions
diff --git a/ui/app/components/tx-view.js b/ui/app/components/tx-view.js
index d7e4a5b4b..c9be0d67d 100644
--- a/ui/app/components/tx-view.js
+++ b/ui/app/components/tx-view.js
@@ -9,7 +9,6 @@ const selectors = require('../selectors')
const BalanceComponent = require('./balance-component')
const TxList = require('./tx-list')
const Identicon = require('./identicon')
-const TokenBalance = require('./token-balance')
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxView)
@@ -18,11 +17,11 @@ function mapStateToProps (state) {
const identities = state.metamask.identities
const accounts = state.metamask.accounts
+ const network = state.metamask.network
const selectedTokenAddress = state.metamask.selectedTokenAddress
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0]
const checksumAddress = selectedAddress && ethUtil.toChecksumAddress(selectedAddress)
const identity = identities[selectedAddress]
- const account = accounts[selectedAddress]
return {
sidebarOpen,
@@ -31,7 +30,7 @@ function mapStateToProps (state) {
selectedTokenAddress,
selectedToken: selectors.getSelectedToken(state),
identity,
- account,
+ network,
}
}
@@ -50,40 +49,55 @@ function TxView () {
}
TxView.prototype.renderHeroBalance = function () {
- const {account, selectedToken, showModal, showSendPage } = this.props
+ const { selectedToken } = this.props
return h('div.hero-balance', {}, [
- h(BalanceComponent, {
- balanceValue: account && account.balance,
- token: selectedToken,
- }),
+ h(BalanceComponent, { token: selectedToken }),
- h('div.flex-row.flex-center.hero-balance-buttons', {}, [
- h('button.btn-clear', {
- style: {
- textAlign: 'center',
- },
- onClick: () => showModal({
- name: 'BUY',
- }),
- }, 'BUY'),
-
- h('button.btn-clear', {
- style: {
- textAlign: 'center',
- marginLeft: '0.8em',
- },
- onClick: showSendPage,
- }, 'SEND'),
-
- ]),
+ this.renderButtons(),
])
}
-TxView.prototype.render = function () {
+TxView.prototype.renderButtons = function () {
+ const {selectedToken, showModal, showSendPage } = this.props
+
+ return !selectedToken
+ ? (
+ h('div.flex-row.flex-center.hero-balance-buttons', [
+ h('button.btn-clear', {
+ style: {
+ textAlign: 'center',
+ },
+ onClick: () => showModal({
+ name: 'BUY',
+ }),
+ }, 'BUY'),
+
+ h('button.btn-clear', {
+ style: {
+ textAlign: 'center',
+ marginLeft: '0.8em',
+ },
+ onClick: showSendPage,
+ }, 'SEND'),
+ ])
+ )
+ : (
+ h('div.flex-row.flex-center.hero-balance-buttons', [
+ h('button.btn-clear', {
+ style: {
+ textAlign: 'center',
+ marginLeft: '0.8em',
+ },
+ onClick: showSendPage,
+ }, 'SEND'),
+ ])
+ )
+}
- const { selectedAddress, identity } = this.props
+TxView.prototype.render = function () {
+ const { selectedAddress, identity, network } = this.props
return h('div.tx-view.flex-column', {
style: {},
@@ -113,6 +127,7 @@ TxView.prototype.render = function () {
h(Identicon, {
diameter: 24,
address: selectedAddress,
+ network,
}),
]),