Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 15:26:51 -04:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2017-09-11 20:26:16 -04:00
|
|
|
import { IWallet } from 'libs/wallet';
|
Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 15:26:51 -04:00
|
|
|
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 * as customTokenActions from 'actions/customTokens';
|
|
|
|
import { showNotification } from 'actions/notifications';
|
|
|
|
|
|
|
|
import AccountInfo from './AccountInfo';
|
|
|
|
import Promos from './Promos';
|
|
|
|
import TokenBalances from './TokenBalances';
|
|
|
|
import EquivalentValues from './EquivalentValues';
|
|
|
|
import { Ether } from 'libs/units';
|
|
|
|
|
|
|
|
type Props = {
|
2017-09-11 20:26:16 -04:00
|
|
|
wallet: IWallet,
|
Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 15:26:51 -04:00
|
|
|
balance: Ether,
|
|
|
|
network: NetworkConfig,
|
|
|
|
tokenBalances: TokenBalance[],
|
|
|
|
rates: { [string]: number },
|
|
|
|
showNotification: Function,
|
|
|
|
addCustomToken: typeof customTokenActions.addCustomToken,
|
|
|
|
removeCustomToken: typeof customTokenActions.removeCustomToken
|
|
|
|
};
|
|
|
|
|
|
|
|
export class BalanceSidebar extends React.Component {
|
|
|
|
props: Props;
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { wallet, balance, network, tokenBalances, rates } = this.props;
|
|
|
|
if (!wallet) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const blocks = [
|
|
|
|
{
|
|
|
|
name: 'Account Info',
|
|
|
|
content: (
|
|
|
|
<AccountInfo wallet={wallet} balance={balance} network={network} />
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Promos',
|
|
|
|
isFullWidth: true,
|
|
|
|
content: <Promos />
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Token Balances',
|
|
|
|
content: (
|
|
|
|
<TokenBalances
|
|
|
|
tokens={tokenBalances}
|
|
|
|
onAddCustomToken={this.props.addCustomToken}
|
|
|
|
onRemoveCustomToken={this.props.removeCustomToken}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Equivalent Values',
|
|
|
|
content: <EquivalentValues balance={balance} rates={rates} />
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<aside>
|
|
|
|
{blocks.map(block =>
|
|
|
|
<section
|
|
|
|
className={`Block ${block.isFullWidth ? 'is-full-width' : ''}`}
|
|
|
|
key={block.name}
|
|
|
|
>
|
|
|
|
{block.content}
|
|
|
|
</section>
|
|
|
|
)}
|
|
|
|
</aside>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapStateToProps(state: State) {
|
|
|
|
return {
|
|
|
|
wallet: getWalletInst(state),
|
|
|
|
balance: state.wallet.balance,
|
|
|
|
tokenBalances: getTokenBalances(state),
|
|
|
|
network: getNetworkConfig(state),
|
|
|
|
rates: state.rates
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, {
|
|
|
|
...customTokenActions,
|
|
|
|
showNotification
|
|
|
|
})(BalanceSidebar);
|