mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-03-02 19:50:38 +00:00
* Make UnlockHeader a PureComponent * MVP * actually disable wallet format if not determined to be valid format for wallet * default to correct derivation in mnemonic modal * cleanup * fix tslint * use enums for HD wallet getPath * Add stricter typing * Fix labels not updating on selector * Ban hardware wallet support for custom network unsupported chainIds * Fix type error * Fix custom node dPath not being saved * Fix mnemonic modal * default path bugfixes * add react-select * misc fixes; rabbit holing hard. * fix tslint * revert identicon changes * reload on network change :/ * actually reload on network change * really really reload on network change * tslint fixes * Update styles * set table width * fix package versioning * push broken sagas * Fix saga test * fix tslint * address round of review * move non-selectors out to utilty; adjust reload timer * cleanup network util comments * manage wallet disable at WalletDecrypt instead of in both WalletDecrypt and WalletButton * Separate WalletDecrypt props into ownProps / StateProps * disable payment requests on non-eth networks * specialize connect; separate props * remove unused state prop * remove bad import * create tests for networks * Clarify Lite-Send error on non-ethereum networkS * remove string option for network config name * Create concept of always-on 'EXTRA_PATHS'; include SINGULAR_DTV legacy dPath in 'EXTRA_PATHS' * fix multiple imports * address PR comments
96 lines
2.5 KiB
TypeScript
96 lines
2.5 KiB
TypeScript
import { fetchCCRates, TFetchCCRates } from 'actions/rates';
|
|
import { NetworkConfig } from 'config';
|
|
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;
|
|
isOffline: AppState['config']['offline'];
|
|
}
|
|
|
|
interface Block {
|
|
name: string;
|
|
content: React.ReactElement<any>;
|
|
isFullWidth?: boolean;
|
|
}
|
|
|
|
export class BalanceSidebar extends React.Component<Props, {}> {
|
|
public render() {
|
|
const { wallet, balance, network, tokenBalances, rates, ratesError, isOffline } = this.props;
|
|
|
|
if (!wallet) {
|
|
return null;
|
|
}
|
|
|
|
const blocks: Block[] = [
|
|
{
|
|
name: 'Account Info',
|
|
content: <AccountInfo wallet={wallet} balance={balance} network={network} />
|
|
},
|
|
{
|
|
name: 'Promos',
|
|
isFullWidth: true,
|
|
content: <Promos />
|
|
},
|
|
{
|
|
name: 'Token Balances',
|
|
content: <TokenBalances />
|
|
},
|
|
{
|
|
name: 'Equivalent Values',
|
|
content: (
|
|
<EquivalentValues
|
|
network={network}
|
|
balance={balance}
|
|
tokenBalances={tokenBalances}
|
|
rates={rates}
|
|
ratesError={ratesError}
|
|
fetchCCRates={this.props.fetchCCRates}
|
|
isOffline={isOffline}
|
|
/>
|
|
)
|
|
}
|
|
];
|
|
|
|
return (
|
|
<aside>
|
|
{blocks.map(block => (
|
|
<section className={`Block ${block.isFullWidth ? 'is-full-width' : ''}`} key={block.name}>
|
|
{block.content}
|
|
</section>
|
|
))}
|
|
</aside>
|
|
);
|
|
}
|
|
}
|
|
|
|
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,
|
|
isOffline: state.config.offline
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, {
|
|
fetchCCRates
|
|
})(BalanceSidebar);
|