2018-01-22 04:21:48 +00:00
|
|
|
import React from 'react';
|
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 19:26:51 +00:00
|
|
|
import translate from 'translations';
|
2018-01-22 04:21:48 +00:00
|
|
|
import { UnitDisplay, Spinner } from 'components/ui';
|
|
|
|
import Select from 'react-select';
|
2018-02-07 23:59:55 +00:00
|
|
|
import { TFetchCCRatesRequested, fetchCCRatesRequested } from 'actions/rates';
|
|
|
|
import { rateSymbols } from 'api/rates';
|
2018-01-22 04:21:48 +00:00
|
|
|
import { chain, flatMap } from 'lodash';
|
2018-01-23 00:12:03 +00:00
|
|
|
import { TokenBalance, getShownTokenBalances } from 'selectors/wallet';
|
2017-11-15 03:44:55 +00:00
|
|
|
import { Balance } from 'libs/wallet';
|
2017-11-15 05:51:09 +00:00
|
|
|
import './EquivalentValues.scss';
|
2018-01-23 00:12:03 +00:00
|
|
|
import { AppState } from 'reducers';
|
2018-02-12 20:43:07 +00:00
|
|
|
import { getNetworkConfig, getOffline } from 'selectors/config';
|
2018-01-23 00:12:03 +00:00
|
|
|
import { connect } from 'react-redux';
|
2018-02-13 00:15:27 +00:00
|
|
|
import btcIco from 'assets/images/bitcoin.png';
|
|
|
|
import ethIco from 'assets/images/ether.png';
|
|
|
|
import repIco from 'assets/images/augur.png';
|
2018-02-12 20:43:07 +00:00
|
|
|
import { NetworkConfig } from 'types/network';
|
2018-03-07 23:36:05 +00:00
|
|
|
import BN from 'bn.js';
|
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 19:26:51 +00:00
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
interface AllValue {
|
|
|
|
symbol: string;
|
|
|
|
balance: Balance['wei'];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DefaultOption {
|
|
|
|
label: string;
|
|
|
|
value: AllValue[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Option {
|
|
|
|
label: string;
|
|
|
|
value: Balance['wei'] | AllValue[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface State {
|
|
|
|
equivalentValues: Option;
|
|
|
|
options: Option[];
|
|
|
|
}
|
2017-11-18 20:15:02 +00:00
|
|
|
|
2018-01-23 00:12:03 +00:00
|
|
|
interface StateProps {
|
2018-01-22 04:21:48 +00:00
|
|
|
balance: Balance;
|
2018-01-23 00:12:03 +00:00
|
|
|
network: NetworkConfig;
|
2018-02-12 20:43:07 +00:00
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
tokenBalances: TokenBalance[];
|
2018-01-23 00:12:03 +00:00
|
|
|
rates: AppState['rates']['rates'];
|
|
|
|
ratesError: AppState['rates']['ratesError'];
|
2018-02-12 20:43:07 +00:00
|
|
|
isOffline: AppState['config']['meta']['offline'];
|
2018-01-23 00:12:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface DispatchProps {
|
2018-02-07 23:59:55 +00:00
|
|
|
fetchCCRates: TFetchCCRatesRequested;
|
2017-11-15 05:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-03-07 23:36:05 +00:00
|
|
|
interface FiatSymbols {
|
|
|
|
[key: string]: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Rates {
|
|
|
|
[rate: string]: number;
|
|
|
|
}
|
|
|
|
|
2018-01-23 00:12:03 +00:00
|
|
|
type Props = StateProps & DispatchProps;
|
|
|
|
|
|
|
|
class EquivalentValues extends React.Component<Props, State> {
|
2017-12-11 20:36:22 +00:00
|
|
|
private requestedCurrencies: string[] | null = null;
|
2018-01-23 00:12:03 +00:00
|
|
|
|
2017-12-19 22:46:34 +00:00
|
|
|
public constructor(props: Props) {
|
2017-11-15 05:51:09 +00:00
|
|
|
super(props);
|
2018-01-22 04:21:48 +00:00
|
|
|
const { balance, tokenBalances, network } = this.props;
|
|
|
|
this.state = {
|
|
|
|
equivalentValues: this.defaultOption(balance, tokenBalances, network),
|
|
|
|
options: []
|
|
|
|
};
|
2017-11-15 05:51:09 +00:00
|
|
|
|
2017-11-18 20:15:02 +00:00
|
|
|
if (props.balance && props.tokenBalances) {
|
|
|
|
this.fetchRates(props);
|
|
|
|
}
|
2017-11-15 05:51:09 +00:00
|
|
|
}
|
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
public defaultOption(
|
|
|
|
balance: Balance,
|
|
|
|
tokenBalances: TokenBalance[],
|
2018-02-12 20:43:07 +00:00
|
|
|
network: StateProps['network']
|
2018-01-22 04:21:48 +00:00
|
|
|
): DefaultOption {
|
|
|
|
return {
|
|
|
|
label: 'All',
|
|
|
|
value: [{ symbol: network.unit, balance: balance.wei }, ...tokenBalances]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-05-11 02:34:27 +00:00
|
|
|
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
2018-02-25 01:32:34 +00:00
|
|
|
const { balance, tokenBalances, isOffline, network } = this.props;
|
2018-01-11 18:04:11 +00:00
|
|
|
if (
|
|
|
|
nextProps.balance !== balance ||
|
|
|
|
nextProps.tokenBalances !== tokenBalances ||
|
2018-02-25 01:32:34 +00:00
|
|
|
nextProps.isOffline !== isOffline ||
|
|
|
|
nextProps.network.unit !== network.unit
|
2018-01-11 18:04:11 +00:00
|
|
|
) {
|
2018-01-22 04:21:48 +00:00
|
|
|
const defaultOption = this.defaultOption(
|
|
|
|
nextProps.balance,
|
|
|
|
nextProps.tokenBalances,
|
|
|
|
nextProps.network
|
|
|
|
);
|
|
|
|
const options: Option[] = [
|
|
|
|
defaultOption,
|
|
|
|
{ label: nextProps.network.unit, value: nextProps.balance.wei },
|
|
|
|
...Object.values(nextProps.tokenBalances).map(token => {
|
|
|
|
return { label: token.symbol, value: token.balance };
|
|
|
|
})
|
|
|
|
];
|
|
|
|
const equivalentValues =
|
|
|
|
options.find(opt => opt.label === this.state.equivalentValues.label) || defaultOption;
|
|
|
|
this.setState({
|
|
|
|
equivalentValues,
|
|
|
|
options
|
|
|
|
});
|
2017-11-18 20:15:02 +00:00
|
|
|
this.fetchRates(nextProps);
|
2017-11-15 05:51:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-07 23:36:05 +00:00
|
|
|
public selectOption = (equivalentValues: Option) => {
|
2018-01-22 04:21:48 +00:00
|
|
|
this.setState({ equivalentValues });
|
|
|
|
};
|
2017-11-15 05:51:09 +00:00
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
public render(): JSX.Element {
|
2018-01-23 00:12:03 +00:00
|
|
|
const { balance, isOffline, tokenBalances, rates, network, ratesError } = this.props;
|
2018-01-22 04:21:48 +00:00
|
|
|
const { equivalentValues, options } = this.state;
|
2017-11-18 20:15:02 +00:00
|
|
|
const isFetching =
|
2017-12-11 20:36:22 +00:00
|
|
|
!balance || balance.isPending || !tokenBalances || Object.keys(rates).length === 0;
|
2018-01-29 18:23:39 +00:00
|
|
|
const pairRates = this.generateValues(equivalentValues.label, equivalentValues.value);
|
2018-03-07 23:36:05 +00:00
|
|
|
const fiatSymbols: FiatSymbols = {
|
2018-02-13 00:15:27 +00:00
|
|
|
USD: '$',
|
|
|
|
EUR: '€',
|
|
|
|
GBP: '£',
|
|
|
|
CHF: ' '
|
|
|
|
};
|
2018-03-07 23:36:05 +00:00
|
|
|
const coinAndTokenSymbols: any = {
|
2018-02-13 00:15:27 +00:00
|
|
|
BTC: btcIco,
|
|
|
|
ETH: ethIco,
|
|
|
|
REP: repIco
|
|
|
|
};
|
2018-03-07 23:36:05 +00:00
|
|
|
interface ValueProps {
|
|
|
|
className: string;
|
|
|
|
rate: string;
|
|
|
|
value: BN | null;
|
|
|
|
symbol?: string;
|
|
|
|
icon?: string;
|
|
|
|
key?: number | string;
|
|
|
|
}
|
2018-01-22 04:21:48 +00:00
|
|
|
|
2018-03-07 23:36:05 +00:00
|
|
|
const Value = (props: ValueProps) => (
|
|
|
|
<div className={`EquivalentValues-values-currency ${props.className}`}>
|
|
|
|
<img src={props.icon} />
|
|
|
|
{!!props.symbol && (
|
|
|
|
<span className="EquivalentValues-values-currency-fiat-symbol">{props.symbol}</span>
|
|
|
|
)}
|
|
|
|
<span className="EquivalentValues-values-currency-label">{props.rate}</span>{' '}
|
2018-01-22 04:21:48 +00:00
|
|
|
<span className="EquivalentValues-values-currency-value">
|
|
|
|
<UnitDisplay
|
|
|
|
unit={'ether'}
|
2018-03-07 23:36:05 +00:00
|
|
|
value={props.value}
|
|
|
|
displayShortBalance={rateSymbols.isFiat(props.rate) ? 2 : 3}
|
2018-01-22 04:21:48 +00:00
|
|
|
checkOffline={true}
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
);
|
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 19:26:51 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="EquivalentValues">
|
2018-01-22 04:21:48 +00:00
|
|
|
<div className="EquivalentValues-header">
|
2018-03-22 03:50:25 +00:00
|
|
|
<h5 className="EquivalentValues-title">{translate('SIDEBAR_EQUIV')}</h5>
|
2018-01-22 04:21:48 +00:00
|
|
|
<Select
|
|
|
|
name="equivalentValues"
|
|
|
|
// TODO: Update type
|
|
|
|
value={equivalentValues as any}
|
|
|
|
options={options as any}
|
2018-03-07 23:36:05 +00:00
|
|
|
onChange={this.selectOption as any}
|
2018-01-22 04:21:48 +00:00
|
|
|
clearable={false}
|
|
|
|
searchable={false}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2018-01-23 00:12:03 +00:00
|
|
|
{isOffline ? (
|
2018-01-11 18:04:11 +00:00
|
|
|
<div className="EquivalentValues-offline well well-sm">
|
2018-03-22 03:50:25 +00:00
|
|
|
{translate('EQUIV_VALS_OFFLINE')}
|
2018-01-11 18:04:11 +00:00
|
|
|
</div>
|
2018-01-22 04:21:48 +00:00
|
|
|
) : network.isTestnet ? (
|
|
|
|
<div className="text-center">
|
2018-03-22 03:50:25 +00:00
|
|
|
<h5 style={{ color: 'red' }}>{translate('EQUIV_VALS_TESTNET')}</h5>
|
2018-01-22 04:21:48 +00:00
|
|
|
</div>
|
|
|
|
) : ratesError ? (
|
|
|
|
<h5>{ratesError}</h5>
|
|
|
|
) : isFetching ? (
|
2018-02-08 23:44:30 +00:00
|
|
|
<div className="EquivalentValues-spinner">
|
|
|
|
<Spinner size="x3" />
|
|
|
|
</div>
|
2018-01-11 18:04:11 +00:00
|
|
|
) : (
|
2018-01-22 04:21:48 +00:00
|
|
|
<div className="EquivalentValues-values">
|
2018-01-29 18:23:39 +00:00
|
|
|
{pairRates.length ? (
|
2018-02-13 00:15:27 +00:00
|
|
|
<React.Fragment>
|
|
|
|
{pairRates.map(
|
|
|
|
(equiv, i) =>
|
|
|
|
(rateSymbols.symbols.fiat as string[]).includes(equiv.rate) && (
|
|
|
|
<Value
|
|
|
|
className="EquivalentValues-values-currency-fiat"
|
|
|
|
rate={equiv.rate}
|
|
|
|
value={equiv.value}
|
|
|
|
symbol={fiatSymbols[equiv.rate]}
|
|
|
|
key={i}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
<div className="EquivalentValues-values-spacer" />
|
|
|
|
{pairRates.map(
|
|
|
|
(equiv, i) =>
|
|
|
|
(rateSymbols.symbols.coinAndToken as string[]).includes(equiv.rate) && (
|
|
|
|
<Value
|
|
|
|
className="EquivalentValues-values-currency-coin-and-token"
|
|
|
|
rate={equiv.rate}
|
|
|
|
value={equiv.value}
|
|
|
|
icon={coinAndTokenSymbols[equiv.rate]}
|
|
|
|
key={i}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
</React.Fragment>
|
2018-01-29 18:23:39 +00:00
|
|
|
) : (
|
2018-03-22 03:50:25 +00:00
|
|
|
<p>{translate('EQUIV_VALS_UNSUPPORTED_UNIT')}</p>
|
2018-01-29 18:23:39 +00:00
|
|
|
)}
|
2018-01-22 04:21:48 +00:00
|
|
|
</div>
|
2018-01-11 18:04:11 +00:00
|
|
|
)}
|
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 19:26:51 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-11-15 05:51:09 +00:00
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
// return the sum of all equivalent values (unit * rate * balance) grouped by rate (USD, EUR, ETH, etc...)
|
|
|
|
private handleAllValues = (balance: AllValue[]) => {
|
|
|
|
const { rates } = this.props;
|
|
|
|
const allRates = Object.values(balance).map(
|
|
|
|
value => !!rates[value.symbol] && rates[value.symbol]
|
|
|
|
);
|
2018-03-07 23:36:05 +00:00
|
|
|
const allEquivalentValues = allRates.map((rateType: any, i) => {
|
2018-01-22 04:21:48 +00:00
|
|
|
return {
|
|
|
|
symbol: Object.keys(rates)[i],
|
|
|
|
equivalentValues: [
|
|
|
|
...Object.keys(rateType).map(rate => {
|
|
|
|
const balanceIndex: AllValue = balance[i];
|
|
|
|
const value =
|
|
|
|
balanceIndex && !!balanceIndex.balance
|
|
|
|
? balanceIndex.balance.muln(rateType[rate])
|
|
|
|
: null;
|
|
|
|
return { rate, value };
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
|
|
|
});
|
|
|
|
// flatten all equivalent values for each unit (ETH, ETC, OMG, etc...) into an array
|
|
|
|
const collection = flatMap([
|
|
|
|
...Object.values(allEquivalentValues).map(v => v.equivalentValues)
|
|
|
|
]);
|
|
|
|
// group equivalent values by rate (USD, EUR, etc...)
|
|
|
|
const groupedCollection = chain(collection)
|
|
|
|
.groupBy('rate')
|
|
|
|
.mapValues(v => Object.values(v).map(s => s.value))
|
|
|
|
.value();
|
|
|
|
// finally, add all the equivalent values together and return an array of objects with the sum of equivalent values for each rate
|
|
|
|
return Object.values(groupedCollection).map((v, i) => {
|
|
|
|
return {
|
|
|
|
rate: Object.keys(groupedCollection)[i],
|
|
|
|
value: v.reduce((acc, curr) => acc && curr && acc.add(curr))
|
|
|
|
};
|
|
|
|
});
|
2017-11-15 05:51:09 +00:00
|
|
|
};
|
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
// return equivalent value (unit * rate * balance)
|
|
|
|
private handleValues(unit: string, balance: Balance['wei']) {
|
|
|
|
const { rates } = this.props;
|
2018-03-07 23:36:05 +00:00
|
|
|
const ratesObj: Rates = { ...rates[unit] };
|
2018-01-22 04:21:48 +00:00
|
|
|
return Object.keys(ratesObj).map(key => {
|
2018-03-07 23:36:05 +00:00
|
|
|
const value = balance!.muln(ratesObj[key]);
|
2018-01-22 04:21:48 +00:00
|
|
|
return { rate: key, value };
|
|
|
|
});
|
2017-11-15 05:51:09 +00:00
|
|
|
}
|
2017-11-18 20:15:02 +00:00
|
|
|
|
2018-01-22 04:21:48 +00:00
|
|
|
private generateValues = (
|
|
|
|
unit: string,
|
|
|
|
balance: Balance['wei'] | AllValue[]
|
|
|
|
): { rate: string; value: Balance['wei'] }[] => {
|
|
|
|
if (unit === 'All') {
|
|
|
|
return this.handleAllValues(balance as AllValue[]);
|
|
|
|
} else {
|
|
|
|
return this.handleValues(unit, balance as Balance['wei']);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-11-18 20:15:02 +00:00
|
|
|
private fetchRates(props: Props) {
|
2018-01-23 00:12:03 +00:00
|
|
|
const { balance, tokenBalances, isOffline } = props;
|
2018-01-11 18:04:11 +00:00
|
|
|
// Duck out if we haven't gotten balances yet, or we're not going to
|
2018-01-23 00:12:03 +00:00
|
|
|
if (!balance || !tokenBalances || isOffline) {
|
2017-11-18 20:15:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// First determine which currencies we're asking for
|
2018-01-22 04:21:48 +00:00
|
|
|
const currencies = tokenBalances
|
2017-11-18 20:15:02 +00:00
|
|
|
.filter(tk => !tk.balance.isZero())
|
|
|
|
.map(tk => tk.symbol)
|
2018-02-25 01:32:34 +00:00
|
|
|
.sort()
|
|
|
|
.concat([props.network.unit]);
|
2017-11-18 20:15:02 +00:00
|
|
|
|
|
|
|
// If it's the same currencies as we have, skip it
|
2017-12-11 20:36:22 +00:00
|
|
|
if (this.requestedCurrencies && currencies.join() === this.requestedCurrencies.join()) {
|
2017-11-18 20:15:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fire off the request and save the currencies requested
|
2018-01-23 00:12:03 +00:00
|
|
|
props.fetchCCRates(currencies);
|
2017-11-18 20:15:02 +00:00
|
|
|
this.requestedCurrencies = currencies;
|
|
|
|
}
|
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 19:26:51 +00:00
|
|
|
}
|
2018-01-23 00:12:03 +00:00
|
|
|
function mapStateToProps(state: AppState): StateProps {
|
|
|
|
return {
|
|
|
|
balance: state.wallet.balance,
|
|
|
|
tokenBalances: getShownTokenBalances(state, true),
|
|
|
|
network: getNetworkConfig(state),
|
|
|
|
rates: state.rates.rates,
|
|
|
|
ratesError: state.rates.ratesError,
|
2018-02-12 20:43:07 +00:00
|
|
|
isOffline: getOffline(state)
|
2018-01-23 00:12:03 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-07 23:59:55 +00:00
|
|
|
export default connect(mapStateToProps, { fetchCCRates: fetchCCRatesRequested })(EquivalentValues);
|