// @flow import './AccountInfo.scss'; import React from 'react'; import translate from 'translations'; import { Identicon } from 'components/ui'; import { formatNumber } from 'utils/formatters'; import type { IWallet } from 'libs/wallet'; import type { NetworkConfig } from 'config/data'; import { Ether } from 'libs/units'; import type { FiatRequestedRatesAction } from 'actions/rates'; type Props = { balance: Ether, wallet: IWallet, network: NetworkConfig, fiatRequestedRates: () => FiatRequestedRatesAction }; export default class AccountInfo extends React.Component { props: Props; state = { showLongBalance: false, address: '' }; componentDidMount() { this.props.fiatRequestedRates(); this.props.wallet.getAddress().then(addr => { this.setState({ address: addr }); }); } toggleShowLongBalance = (e: SyntheticMouseEvent) => { e.preventDefault(); this.setState(state => { return { showLongBalance: !state.showLongBalance }; }); }; render() { const { network, balance } = this.props; const { blockExplorer, tokenExplorer } = network; const { address } = this.state; return (
{translate('sidebar_AccountAddr')}
{address}
{translate('sidebar_AccountBal')}
{(!!blockExplorer || !!tokenExplorer) &&
{translate('sidebar_TransHistory')}
}
); } }