diff --git a/src/components/Display.jsx b/src/components/Display.jsx index e575953..d021b81 100644 --- a/src/components/Display.jsx +++ b/src/components/Display.jsx @@ -1,13 +1,25 @@ -export const ValueDisplay = ({prefix, value, suffix}) =>{ - let val = '---' +import { useState } from 'react'; +import {CaretUpOutlined, CaretDownOutlined} from '@ant-design/icons' +export const ValueDisplay = ({prefix, value, suffix, isArrowVisible}) =>{ + const [oldVal, setOldVal] = useState(NaN) + + let val = '---' + let arrow = null if(value) - if(Number.isFinite(+value)) + if(Number.isFinite(+value)){ val = (+value).toPrecision(4)??'---' - else + if (isArrowVisible) + { + arrow = value > oldVal + ? + : + setOldVal(value) + } + } else val = value - return({prefix} {val} {suffix}) + return({prefix} {val} {suffix}{arrow}) } export const Display = (props)=>{ diff --git a/src/pages/TelemetryView.jsx b/src/pages/TelemetryView.jsx index 8dcb0aa..5e6e321 100644 --- a/src/pages/TelemetryView.jsx +++ b/src/pages/TelemetryView.jsx @@ -97,7 +97,7 @@ export const Column = ({ lineGroup, data, interval }) => { + suffix={lineGroup.linePv?.units} isArrowVisible={true}/>