import { fetchCCRates, TFetchCCRates } from 'actions/rates'; import { NetworkConfig } from 'config/data'; import { IWallet, Balance } from 'libs/wallet'; import React from 'react'; import { connect } from 'react-redux'; import { AppState } from 'reducers'; import { getNetworkConfig } from 'selectors/config'; import { getShownTokenBalances, 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: Balance; network: NetworkConfig; tokenBalances: TokenBalance[]; rates: AppState['rates']['rates']; ratesError: AppState['rates']['ratesError']; fetchCCRates: TFetchCCRates; } interface Block { name: string; content: React.ReactElement; isFullWidth?: boolean; } export class BalanceSidebar extends React.Component { public render() { const { wallet, balance, network, tokenBalances, rates, ratesError } = 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: getShownTokenBalances(state, true), network: getNetworkConfig(state), rates: state.rates.rates, ratesError: state.rates.ratesError }; } export default connect(mapStateToProps, { fetchCCRates })(BalanceSidebar);