A Metamask fork with Infura removed and default networks editable
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.
ciphermask/ui/app/components/account-panel.js

61 lines
1.5 KiB

const inherits = require('util').inherits
const Component = require('react').Component
const h = require('react-hyperscript')
const formatBalance = require('../util').formatBalance
const addressSummary = require('../util').addressSummary
const Panel = require('./panel')
module.exports = AccountPanel
inherits(AccountPanel, Component)
8 years ago
function AccountPanel () {
Component.call(this)
}
8 years ago
AccountPanel.prototype.render = function () {
var state = this.props
var identity = state.identity || {}
var account = state.account || {}
var isFauceting = state.isFauceting
var panelOpts = {
key: `accountPanel${identity.address}`,
onClick: (event) => {
if (state.onShowDetail) {
state.onShowDetail(identity.address, event)
}
},
identiconKey: identity.address,
identiconLabel: identity.name,
attributes: [
{
key: 'ADDRESS',
value: addressSummary(identity.address),
},
balanceOrFaucetingIndication(account, isFauceting),
8 years ago
],
}
return h(Panel, panelOpts,
!state.onShowDetail ? null : h('.arrow-right.cursor-pointer', [
h('i.fa.fa-chevron-right.fa-lg'),
]))
}
8 years ago
function balanceOrFaucetingIndication (account, isFauceting) {
// Temporarily deactivating isFauceting indication
// because it shows fauceting for empty restored accounts.
8 years ago
if (/* isFauceting*/ false) {
return {
key: 'Account is auto-funding.',
value: 'Please wait.',
}
} else {
return {
key: 'BALANCE',
8 years ago
value: formatBalance(account.balance),
}
}
}