asb_cloud_front/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx
2021-08-12 17:47:16 +05:00

52 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {ValueDisplay} from '../../components/Display'
import {ControlOutlined} from '@ant-design/icons'
import {Popover} from 'antd'
export const ChartTimeOnlineFooter = (props) =>{
const { data,
lineIdle,
lineSp,
linesOther} = props
let sp = null
let idle = null
if(data && lineSp)
sp = data[lineSp.xAccessorName]
if(data && lineIdle)
idle = data[lineIdle.xAccessorName]
let spField = <ValueDisplay value={sp}/>
let popContent = linesOther?.map(line =>{
let val = null
if(data)
val = data[line.xAccessorName]
return (
<div key={line.label}>
{line.label}
<ValueDisplay value={val}/>
</div>)
})
if(popContent)
spField = <Popover content={popContent}>
<div className="chart-footer">
<ControlOutlined className='display_label'/>
{spField}
</div>
</Popover>
else
spField = <div style={{display:"flex"}}>
{spField}
</div>
return(<div>
{spField}
<div style={{display:"flex"}}>
<span className='display_label'>х.х.</span>
<ValueDisplay value={idle}/>
</div>
</div>)
}