aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/accounts
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-05-24 06:31:11 +0800
committerDan Finlay <dan@danfinlay.com>2016-05-24 06:31:11 +0800
commitadaf1c7012b398d5d0d548553ba35e80cf5c3d31 (patch)
tree5e8f9b792dc2c3baab25faddea18a3618abc2f74 /ui/app/accounts
parent45916175d7281ff0eba25fcb5918a01e02baad7c (diff)
downloadtangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar.gz
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar.bz2
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar.lz
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar.xz
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.tar.zst
tangerine-wallet-browser-adaf1c7012b398d5d0d548553ba35e80cf5c3d31.zip
Add copy address button to account list
Diffstat (limited to 'ui/app/accounts')
-rw-r--r--ui/app/accounts/account-panel.js48
-rw-r--r--ui/app/accounts/index.js5
2 files changed, 47 insertions, 6 deletions
diff --git a/ui/app/accounts/account-panel.js b/ui/app/accounts/account-panel.js
index 9e4eca20f..5ade7fe0e 100644
--- a/ui/app/accounts/account-panel.js
+++ b/ui/app/accounts/account-panel.js
@@ -1,6 +1,12 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const ethUtil = require('ethereumjs-util')
+
+const EtherBalance = require('../components/eth-balance')
+const addressSummary = require('../util').addressSummary
+const copyToClipboard = require('copy-to-clipboard')
+const Identicon = require('../components/identicon')
module.exports = NewComponent
@@ -11,9 +17,47 @@ function NewComponent() {
}
NewComponent.prototype.render = function() {
- var state = this.props
+ const identity = this.props.identity
+ var mayBeFauceting = identity.mayBeFauceting
+ var isSelected = this.props.selectedAddress === identity.address
+ var account = this.props.accounts[identity.address]
+ var isFauceting = mayBeFauceting && account.balance === '0x0'
+ const selectedClass = isSelected ? '.selected' : ''
return (
- h('span', 'Placeholder component')
+ 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),
+ }, [
+
+ h('.identicon-wrapper.flex-column.flex-center.select-none', [
+ h(Identicon, {
+ address: identity.address
+ }),
+ ]),
+
+ // account address, balance
+ h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', [
+
+ h('span', identity.name),
+ h('span.font-small', addressSummary(identity.address)),
+ h(EtherBalance, {
+ value: account.balance,
+ }),
+ ]),
+
+ h('.identity-copy.flex-column', [
+ h('i.fa.fa-clipboard.fa-md.cursor-pointer.color-orange', {
+ onClick: (event) => {
+ event.stopPropagation()
+ event.preventDefault()
+ copyToClipboard(ethUtil.toChecksumAddress(identity.address))
+ }
+ }),
+ ])
+ ])
)
}
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index 9ddcfdcab..1a42f7470 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -3,12 +3,8 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const extend = require('xtend')
-const Identicon = require('../components/identicon')
const actions = require('../actions')
-const EtherBalance = require('../components/eth-balance')
const valuesFor = require('../util').valuesFor
-const addressSummary = require('../util').addressSummary
-const formatBalance = require('../util').formatBalance
const findDOMNode = require('react-dom').findDOMNode
const AccountPanel = require('./account-panel')
@@ -67,6 +63,7 @@ AccountsScreen.prototype.render = function() {
[
identityList.map((identity) => {
return h(AccountPanel, {
+ key: `acct-panel-${identity.address}`,
identity,
selectedAddress: this.props.selectedAddress,
accounts: this.props.accounts,