parent
7e98b0b38a
commit
58d8ac8f67
|
@ -2,12 +2,18 @@
|
||||||
import React, {PureComponent} from 'react'
|
import React, {PureComponent} from 'react'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import EmptyGraphMessage from 'src/shared/components/EmptyGraphMessage'
|
||||||
|
|
||||||
// Parsing
|
// Parsing
|
||||||
import getLastValues from 'src/shared/parsing/flux/fluxToSingleStat'
|
import getLastValues from 'src/shared/parsing/flux/fluxToSingleStat'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {FluxTable} from 'src/types'
|
import {FluxTable} from 'src/types'
|
||||||
|
|
||||||
|
const NON_NUMERIC_ERROR =
|
||||||
|
'Could not display single stat because your values are non-numeric'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tables: FluxTable[]
|
tables: FluxTable[]
|
||||||
children: (stat: number) => JSX.Element
|
children: (stat: number) => JSX.Element
|
||||||
|
@ -18,11 +24,7 @@ export default class SingleStatTransform extends PureComponent<Props> {
|
||||||
const lastValue = +this.lastValue
|
const lastValue = +this.lastValue
|
||||||
|
|
||||||
if (!_.isFinite(lastValue)) {
|
if (!_.isFinite(lastValue)) {
|
||||||
return (
|
return <EmptyGraphMessage message={NON_NUMERIC_ERROR} />
|
||||||
<div>
|
|
||||||
Could not display single stat because your values are non-numeric
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.props.children(lastValue)
|
return this.props.children(lastValue)
|
||||||
|
|
Loading…
Reference in New Issue