2016-05-06 23:24:01 +02:00
|
|
|
const inherits = require('util').inherits
|
|
|
|
const ethUtil = require('ethereumjs-util')
|
|
|
|
const Component = require('react').Component
|
|
|
|
const h = require('react-hyperscript')
|
2016-05-11 08:07:01 +02:00
|
|
|
const Identicon = require('./identicon')
|
2016-05-06 23:24:01 +02:00
|
|
|
|
|
|
|
module.exports = Panel
|
|
|
|
|
|
|
|
|
|
|
|
inherits(Panel, Component)
|
|
|
|
function Panel() {
|
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
|
|
|
Panel.prototype.render = function() {
|
|
|
|
var state = this.props
|
|
|
|
|
|
|
|
var identity = state.identity || {}
|
|
|
|
var account = state.account || {}
|
|
|
|
var isFauceting = state.isFauceting
|
2016-05-14 01:28:46 +02:00
|
|
|
var style = {
|
|
|
|
flex: '1 0 auto',
|
|
|
|
}
|
|
|
|
|
|
|
|
if (state.onClick) style.cursor = 'pointer'
|
2016-05-06 23:24:01 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
h('.identity-panel.flex-row.flex-space-between', {
|
2016-05-14 01:28:46 +02:00
|
|
|
style,
|
2016-05-06 23:24:01 +02:00
|
|
|
onClick: state.onClick,
|
|
|
|
}, [
|
|
|
|
|
|
|
|
// account identicon
|
|
|
|
h('.identicon-wrapper.flex-column.select-none', [
|
2016-05-11 08:07:01 +02:00
|
|
|
h(Identicon, {
|
|
|
|
address: state.identiconKey,
|
2016-05-06 23:24:01 +02:00
|
|
|
}),
|
|
|
|
h('span.font-small', state.identiconLabel),
|
|
|
|
]),
|
|
|
|
|
|
|
|
// account address, balance
|
|
|
|
h('.identity-data.flex-column.flex-justify-center.flex-grow.select-none', [
|
|
|
|
|
|
|
|
state.attributes.map((attr) => {
|
|
|
|
return h('.flex-row.flex-space-between', {
|
|
|
|
key: '' + Math.round(Math.random() * 1000000),
|
|
|
|
}, [
|
2016-05-14 01:28:46 +02:00
|
|
|
h('label.font-small.no-select', attr.key),
|
2016-05-06 23:24:01 +02:00
|
|
|
h('span.font-small', attr.value),
|
|
|
|
])
|
|
|
|
}),
|
|
|
|
]),
|
|
|
|
|
|
|
|
// outlet for inserting additional stuff
|
|
|
|
state.children,
|
|
|
|
])
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|