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