You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.3 KiB
82 lines
2.3 KiB
9 years ago
|
const Component = require('react').Component
|
||
|
const h = require('react-hyperscript')
|
||
|
const inherits = require('util').inherits
|
||
9 years ago
|
const ethUtil = require('ethereumjs-util')
|
||
|
|
||
|
const EtherBalance = require('../components/eth-balance')
|
||
|
const copyToClipboard = require('copy-to-clipboard')
|
||
|
const Identicon = require('../components/identicon')
|
||
9 years ago
|
|
||
|
module.exports = NewComponent
|
||
|
|
||
|
inherits(NewComponent, Component)
|
||
9 years ago
|
function NewComponent () {
|
||
9 years ago
|
Component.call(this)
|
||
|
}
|
||
|
|
||
9 years ago
|
NewComponent.prototype.render = function () {
|
||
9 years ago
|
const identity = this.props.identity
|
||
|
var isSelected = this.props.selectedAddress === identity.address
|
||
|
var account = this.props.accounts[identity.address]
|
||
|
const selectedClass = isSelected ? '.selected' : ''
|
||
9 years ago
|
|
||
|
return (
|
||
9 years ago
|
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', [
|
||
9 years ago
|
this.pendingOrNot(),
|
||
9 years ago
|
h(Identicon, {
|
||
9 years ago
|
address: identity.address,
|
||
9 years ago
|
imageify: true,
|
||
9 years ago
|
}),
|
||
|
]),
|
||
|
|
||
|
// account address, balance
|
||
9 years ago
|
h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', {
|
||
|
style: {
|
||
|
width: '200px',
|
||
|
},
|
||
|
}, [
|
||
9 years ago
|
h('span', identity.name),
|
||
9 years ago
|
h('span.font-small', {
|
||
|
style: {
|
||
|
overflow: 'hidden',
|
||
|
textOverflow: 'ellipsis',
|
||
|
},
|
||
|
}, ethUtil.toChecksumAddress(identity.address)),
|
||
9 years ago
|
h(EtherBalance, {
|
||
|
value: account.balance,
|
||
|
}),
|
||
|
]),
|
||
|
|
||
9 years ago
|
// copy button
|
||
|
h('.identity-copy.flex-column', {
|
||
|
style: {
|
||
|
margin: '0 20px',
|
||
|
},
|
||
|
}, [
|
||
9 years ago
|
h('img.cursor-pointer.color-orange', {
|
||
|
src: 'images/copy.svg',
|
||
9 years ago
|
onClick: (event) => {
|
||
|
event.stopPropagation()
|
||
|
event.preventDefault()
|
||
|
copyToClipboard(ethUtil.toChecksumAddress(identity.address))
|
||
9 years ago
|
},
|
||
9 years ago
|
}),
|
||
9 years ago
|
]),
|
||
9 years ago
|
])
|
||
9 years ago
|
)
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
NewComponent.prototype.pendingOrNot = function () {
|
||
9 years ago
|
const pending = this.props.pending
|
||
|
if (pending.length === 0) return null
|
||
|
return h('.pending-dot', pending.length)
|
||
|
}
|