diff --git a/src/components/base/Chart/Tooltip.js b/src/components/base/Chart/Tooltip.js
index 45651e67..fcdffac8 100644
--- a/src/components/base/Chart/Tooltip.js
+++ b/src/components/base/Chart/Tooltip.js
@@ -6,7 +6,7 @@ import type { Unit } from '@ledgerhq/currencies'
import { colors as themeColors } from 'styles/theme'
import { TooltipContainer } from 'components/base/Tooltip'
-import FormattedVal from 'components/base/FormattedVal'
+import { FormattedVal } from 'components/base/FormattedVal'
import type { Item } from './types'
diff --git a/src/components/base/Chart/handleMouseEvents.js b/src/components/base/Chart/handleMouseEvents.js
index 9f528a26..9f39e8c3 100644
--- a/src/components/base/Chart/handleMouseEvents.js
+++ b/src/components/base/Chart/handleMouseEvents.js
@@ -4,6 +4,9 @@ import React from 'react'
import * as d3 from 'd3'
import { renderToString } from 'react-dom/server'
import { ThemeProvider } from 'styled-components'
+import { Provider } from 'react-redux'
+
+import createStore from 'renderer/createStore'
import theme from 'styles/theme'
@@ -92,9 +95,11 @@ export default function handleMouseEvents({
NODES.tooltip
.html(
renderToString(
-
-
- ,
+
+
+
+
+ ,
),
)
.style('transform', `translate3d(${MARGINS.left + x(d.parsedDate)}px, ${y(d.value)}px, 0)`)
diff --git a/src/components/base/FormattedVal/index.js b/src/components/base/FormattedVal/index.js
index e163f569..b882db24 100644
--- a/src/components/base/FormattedVal/index.js
+++ b/src/components/base/FormattedVal/index.js
@@ -28,10 +28,14 @@ const T = styled(Box).attrs({
white-space: pre;
`
-const I = ({ color, children }: { color: string, children: any }) => (
+const I = ({ color, children }: { color?: string, children: any }) => (
{children}
)
+I.defaultProps = {
+ color: undefined,
+}
+
const mapStateToProps = state => ({
settings: state.settings,
})
@@ -43,14 +47,14 @@ type Props = {
disableRounding?: boolean,
fiat?: string | null,
isPercent?: boolean,
- settings: Settings,
+ settings?: Settings,
showCode?: boolean,
unit?: Unit | null,
val: number,
withIcon?: boolean,
}
-function FormattedVal(props: Props) {
+export function FormattedVal(props: Props) {
const {
animateTicker,
disableRounding,
@@ -97,25 +101,21 @@ function FormattedVal(props: Props) {
text =
}
- const marketColor = getMarketColor({
- marketIndicator: settings.marketIndicator,
- isNegative,
- })
+ const marketColor = settings
+ ? getMarketColor({
+ marketIndicator: settings.marketIndicator,
+ isNegative,
+ })
+ : undefined
return (
{withIcon ? (
- {isNegative ? (
-
-
-
- ) : (
-
-
-
- )}
+
+ {isNegative ? : }
+
{text}
@@ -135,6 +135,7 @@ FormattedVal.defaultProps = {
disableRounding: false,
fiat: null,
isPercent: false,
+ settings: undefined,
showCode: false,
unit: null,
withIcon: false,