import { addCustomToken, removeCustomToken, TAddCustomToken, TRemoveCustomToken } from 'actions/customTokens'; import { showNotification, TShowNotification } from 'actions/notifications'; import { fiatRequestedRates as dFiatRequestedRates, TFiatRequestedRates } from 'actions/rates'; import { NetworkConfig } from 'config/data'; import { Ether } from 'libs/units'; import { IWallet } from 'libs/wallet/IWallet'; import React from 'react'; import { connect } from 'react-redux'; import { AppState } from 'reducers'; import { getNetworkConfig } from 'selectors/config'; import { getTokenBalances, getWalletInst, TokenBalance } from 'selectors/wallet'; import AccountInfo from './AccountInfo'; import EquivalentValues from './EquivalentValues'; import Promos from './Promos'; import TokenBalances from './TokenBalances'; interface Props { wallet: IWallet; balance: Ether; network: NetworkConfig; tokenBalances: TokenBalance[]; rates: { [key: string]: number }; showNotification: TShowNotification; addCustomToken: TAddCustomToken; removeCustomToken: TRemoveCustomToken; fiatRequestedRates: TFiatRequestedRates; } interface Block { name: string; content: React.ReactElement; isFullWidth?: boolean; } export class BalanceSidebar extends React.Component { public render() { const { wallet, balance, network, tokenBalances, rates, fiatRequestedRates } = this.props; if (!wallet) { return null; } const blocks: Block[] = [ { name: 'Account Info', content: ( ) }, { name: 'Promos', isFullWidth: true, content: }, { name: 'Token Balances', content: ( ) }, { name: 'Equivalent Values', content: } ]; return ( ); } } function mapStateToProps(state: AppState) { return { wallet: getWalletInst(state), balance: state.wallet.balance, tokenBalances: getTokenBalances(state), network: getNetworkConfig(state), rates: state.rates }; } export default connect(mapStateToProps, { addCustomToken, removeCustomToken, showNotification, fiatRequestedRates: dFiatRequestedRates })(BalanceSidebar);