// @flow import React from 'react'; import Big from 'big.js'; import { BaseWallet } from 'libs/wallet'; import type { NetworkConfig } from 'config/data'; import type { State } from 'reducers'; import { connect } from 'react-redux'; import { getWalletInst, getTokenBalances } from 'selectors/wallet'; import type { TokenBalance } from 'selectors/wallet'; import { getNetworkConfig } from 'selectors/config'; import { Link } from 'react-router'; import TokenBalances from './TokenBalances'; import { formatNumber } from 'utils/formatters'; import { Identicon } from 'components/ui'; import translate from 'translations'; import * as customTokenActions from 'actions/customTokens'; type Props = { wallet: BaseWallet, balance: Big, network: NetworkConfig, tokenBalances: TokenBalance[], rates: { [string]: number }, addCustomToken: typeof customTokenActions.addCustomToken, removeCustomToken: typeof customTokenActions.removeCustomToken }; export class BalanceSidebar extends React.Component { props: Props; state = { showLongBalance: false }; render() { const { wallet, balance, network, tokenBalances, rates } = this.props; const { blockExplorer, tokenExplorer } = network; if (!wallet) { return null; } return ( ); } toggleShowLongBalance = (e: SyntheticMouseEvent) => { e.preventDefault(); this.setState(state => { return { showLongBalance: !state.showLongBalance }; }); }; } function mapStateToProps(state: State, props: Props) { return { wallet: getWalletInst(state), balance: state.wallet.balance, tokenBalances: getTokenBalances(state), network: getNetworkConfig(state), rates: state.rates }; } export default connect(mapStateToProps, customTokenActions)(BalanceSidebar);