aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/accounts/account-list-item.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/accounts/account-list-item.js')
-rw-r--r--ui/app/accounts/account-list-item.js42
1 files changed, 25 insertions, 17 deletions
diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js
index aa80e0e23..2a3c13d05 100644
--- a/ui/app/accounts/account-list-item.js
+++ b/ui/app/accounts/account-list-item.js
@@ -3,34 +3,34 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util')
-const AccountEtherBalance = require('../components/account-eth-balance')
+const EthBalance = require('../components/eth-balance')
const CopyButton = require('../components/copyButton')
const Identicon = require('../components/identicon')
-module.exports = NewComponent
+module.exports = AccountListItem
-inherits(NewComponent, Component)
-function NewComponent () {
+inherits(AccountListItem, Component)
+function AccountListItem () {
Component.call(this)
}
-NewComponent.prototype.render = function () {
- const identity = this.props.identity
- var isSelected = this.props.selectedAddress === identity.address
- var account = this.props.accounts[identity.address]
+AccountListItem.prototype.render = function () {
+ const { identity, selectedAddress, accounts, onShowDetail } = this.props
+
+ const checksumAddress = identity && identity.address && ethUtil.toChecksumAddress(identity.address)
+ const isSelected = selectedAddress === identity.address
+ const account = accounts[identity.address]
const selectedClass = isSelected ? '.selected' : ''
return (
h(`.accounts-list-option.flex-row.flex-space-between.pointer.hover-white${selectedClass}`, {
key: `account-panel-${identity.address}`,
- style: {
- flex: '1 0 auto',
- },
- onClick: (event) => this.props.onShowDetail(identity.address, event),
+ onClick: (event) => onShowDetail(identity.address, event),
}, [
h('.identicon-wrapper.flex-column.flex-center.select-none', [
this.pendingOrNot(),
+ this.indicateIfLoose(),
h(Identicon, {
address: identity.address,
imageify: true,
@@ -49,9 +49,9 @@ NewComponent.prototype.render = function () {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
- }, ethUtil.toChecksumAddress(identity.address)),
- h(AccountEtherBalance, {
- value: account.balance,
+ }, checksumAddress),
+ h(EthBalance, {
+ value: account && account.balance,
style: {
lineHeight: '7px',
marginTop: '10px',
@@ -66,14 +66,22 @@ NewComponent.prototype.render = function () {
},
}, [
h(CopyButton, {
- value: ethUtil.toChecksumAddress(identity.address),
+ value: checksumAddress,
}),
]),
])
)
}
-NewComponent.prototype.pendingOrNot = function () {
+AccountListItem.prototype.indicateIfLoose = function () {
+ try { // Sometimes keyrings aren't loaded yet:
+ const type = this.props.keyring.type
+ const isLoose = type !== 'HD Key Tree'
+ return isLoose ? h('.keyring-label', 'LOOSE') : null
+ } catch (e) { return }
+}
+
+AccountListItem.prototype.pendingOrNot = function () {
const pending = this.props.pending
if (pending.length === 0) return null
return h('.pending-dot', pending.length)