diff --git a/src/components/AccountPage/index.js b/src/components/AccountPage/index.js index 5aadb530..4ea52c02 100644 --- a/src/components/AccountPage/index.js +++ b/src/components/AccountPage/index.js @@ -148,10 +148,14 @@ class AccountPage extends PureComponent { counterValue={counterValue} daysCount={daysCount} selectedTimeRange={selectedTimeRange} - renderHeader={({ totalBalance, sinceBalance, refBalance }) => ( + renderHeader={({ isAvailable, totalBalance, sinceBalance, refBalance }) => ( - + { { since={selectedTimeRange} /> - - {t(`app:time.since.${since}`)} + {!isAvailable ? ( + + ) : ( + + )} + {!isAvailable ? ( + + ) : ( + {t(`app:time.since.${since}`)} + )} ) } export function BalanceSinceDiff(props: Props) { - const { t, totalBalance, sinceBalance, since, counterValue, ...otherProps } = props + const { t, totalBalance, sinceBalance, since, counterValue, isAvailable, ...otherProps } = props return ( - - {t(`app:time.since.${since}`)} + {!isAvailable ? ( + + ) : ( + + )} + {!isAvailable ? ( + + ) : ( + {t(`app:time.since.${since}`)} + )} ) } export function BalanceTotal(props: BalanceTotalProps) { - const { unit, totalBalance, children } = props + const { unit, totalBalance, isAvailable, children } = props return ( - - {children} + {!isAvailable ? ( + + ) : ( + + )} + {!isAvailable ? : children} ) } @@ -93,16 +116,21 @@ BalanceTotal.defaultProps = { } function BalanceInfos(props: Props) { - const { t, totalBalance, since, sinceBalance, refBalance, counterValue } = props + const { t, totalBalance, since, sinceBalance, refBalance, isAvailable, counterValue } = props return ( - + {t('app:dashboard.totalBalance')} *, } @@ -37,54 +38,54 @@ const BalanceSummary = ({ return ( - {({ isAvailable, balanceHistory, balanceStart, balanceEnd }) => - !isAvailable ? null : ( - - {renderHeader ? ( - - {renderHeader({ - selectedTimeRange, - // FIXME refactor these - totalBalance: balanceEnd, - sinceBalance: balanceStart, - refBalance: balanceStart, - })} - - ) : null} - - formatShort(counterValue.units[0], val)} - renderTooltip={ - isAvailable && !account - ? d => ( - - - - {d.date.toISOString().substr(0, 10)} - - - ) - : undefined - } - /> + {({ isAvailable, balanceHistory, balanceStart, balanceEnd }) => ( + + {renderHeader ? ( + + {renderHeader({ + isAvailable, + selectedTimeRange, + // FIXME refactor these + totalBalance: balanceEnd, + sinceBalance: balanceStart, + refBalance: balanceStart, + })} - - ) - } + ) : null} + + formatShort(counterValue.units[0], val)} + isInteractive={isAvailable} + renderTooltip={ + isAvailable && !account + ? d => ( + + + + {d.date.toISOString().substr(0, 10)} + + + ) + : undefined + } + /> + + + )} ) diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index 4267a429..c92116ce 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -120,10 +120,17 @@ class DashboardPage extends PureComponent { accounts={accounts} selectedTimeRange={selectedTimeRange} daysCount={daysCount} - renderHeader={({ totalBalance, selectedTimeRange, sinceBalance, refBalance }) => ( + renderHeader={({ + isAvailable, + totalBalance, + selectedTimeRange, + sinceBalance, + refBalance, + }) => ( (p.dark ? '#C2C2C2' : '#D6D6D6')}; + width: ${p => p.width}px; + height: 10px; + border-radius: 5px; + margin: 5px 0; +` diff --git a/src/config/constants.js b/src/config/constants.js index 74ca72ef..51a9637b 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -29,6 +29,10 @@ export const DEVICE_DISCONNECT_DEBOUNCE = intFromEnv('LEDGER_DEVICE_DISCONNECT_D // Endpoints... +export const LEDGER_COUNTERVALUES_API = stringFromEnv( + 'LEDGER_COUNTERVALUES_API', + 'https://ledger-countervalue-poc.herokuapp.com', +) export const LEDGER_REST_API_BASE = stringFromEnv( 'LEDGER_REST_API_BASE', 'https://api.ledgerwallet.com/', diff --git a/src/helpers/countervalues.js b/src/helpers/countervalues.js index a6671bcf..7f8801b1 100644 --- a/src/helpers/countervalues.js +++ b/src/helpers/countervalues.js @@ -1,6 +1,7 @@ // @flow import { createSelector } from 'reselect' +import { LEDGER_COUNTERVALUES_API } from 'config/constants' import createCounterValues from '@ledgerhq/live-common/lib/countervalues' import { setExchangePairsAction } from 'actions/settings' import { currenciesSelector } from 'reducers/accounts' @@ -53,7 +54,7 @@ const addExtraPollingHooks = (schedulePoll, cancelPoll) => { const CounterValues = createCounterValues({ log: (...args) => logger.log('CounterValues:', ...args), - getAPIBaseURL: () => 'https://ledger-countervalue-poc.herokuapp.com', + getAPIBaseURL: () => LEDGER_COUNTERVALUES_API, storeSelector: state => state.countervalues, pairsSelector, setExchangePairsAction,