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.
74 lines
1.9 KiB
74 lines
1.9 KiB
7 years ago
|
import React, { Component } from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
|
import { checksumAddress } from '../../../util'
|
||
|
import Identicon from '../../identicon'
|
||
7 years ago
|
import CurrencyDisplay from '../currency-display'
|
||
7 years ago
|
|
||
|
export default class AccountListItem extends Component {
|
||
|
|
||
|
static propTypes = {
|
||
|
account: PropTypes.object,
|
||
|
className: PropTypes.string,
|
||
|
conversionRate: PropTypes.number,
|
||
|
currentCurrency: PropTypes.string,
|
||
|
displayAddress: PropTypes.bool,
|
||
|
displayBalance: PropTypes.bool,
|
||
|
handleClick: PropTypes.func,
|
||
|
icon: PropTypes.node,
|
||
|
};
|
||
|
|
||
6 years ago
|
static contextTypes = {
|
||
|
t: PropTypes.func,
|
||
|
};
|
||
|
|
||
7 years ago
|
render () {
|
||
|
const {
|
||
|
account,
|
||
7 years ago
|
className,
|
||
7 years ago
|
conversionRate,
|
||
|
currentCurrency,
|
||
|
displayAddress = false,
|
||
7 years ago
|
displayBalance = true,
|
||
|
handleClick,
|
||
|
icon = null,
|
||
7 years ago
|
} = this.props
|
||
|
|
||
|
const { name, address, balance } = account || {}
|
||
|
|
||
|
return (<div
|
||
|
className={`account-list-item ${className}`}
|
||
|
onClick={() => handleClick({ name, address, balance })}
|
||
|
>
|
||
|
|
||
7 years ago
|
<div className="account-list-item__top-row">
|
||
7 years ago
|
<Identicon
|
||
|
address={address}
|
||
7 years ago
|
className="account-list-item__identicon"
|
||
7 years ago
|
diameter={18}
|
||
|
/>
|
||
|
|
||
7 years ago
|
<div className="account-list-item__account-name">{ name || address }</div>
|
||
7 years ago
|
|
||
7 years ago
|
{icon && <div className="account-list-item__icon">{ icon }</div>}
|
||
7 years ago
|
|
||
|
</div>
|
||
|
|
||
7 years ago
|
{displayAddress && name && <div className="account-list-item__account-address">
|
||
7 years ago
|
{ checksumAddress(address) }
|
||
|
</div>}
|
||
|
|
||
|
{displayBalance && <CurrencyDisplay
|
||
7 years ago
|
className="account-list-item__account-balances"
|
||
7 years ago
|
conversionRate={conversionRate}
|
||
7 years ago
|
convertedBalanceClassName="account-list-item__account-secondary-balance"
|
||
|
convertedCurrency={currentCurrency}
|
||
|
primaryBalanceClassName="account-list-item__account-primary-balance"
|
||
|
primaryCurrency="ETH"
|
||
7 years ago
|
readOnly={true}
|
||
7 years ago
|
value={balance}
|
||
7 years ago
|
/>}
|
||
|
|
||
|
</div>)
|
||
|
}
|
||
|
}
|