From 4065c125b0cc1d4f66fb0391b23a7b3e1371f2ba Mon Sep 17 00:00:00 2001 From: Hristo Nedelkov Date: Thu, 10 Aug 2023 09:07:24 +0300 Subject: [PATCH] Tweaks --- src/components/StandardLineChart.tsx | 6 +++--- src/components/deviceCPULoad.tsx | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/StandardLineChart.tsx b/src/components/StandardLineChart.tsx index 79bc221d..43bde4e0 100644 --- a/src/components/StandardLineChart.tsx +++ b/src/components/StandardLineChart.tsx @@ -9,10 +9,10 @@ interface Serie { data: DataPoint[] } -interface MyResponsiveLineProps { +interface StandartLineChartProps { data: Serie[] } -const MyResponsiveLine = ({ data }: MyResponsiveLineProps) => { +const StandartLineChart = ({ data }: StandartLineChartProps) => { return ( { /> ) } -export default MyResponsiveLine +export default StandartLineChart diff --git a/src/components/deviceCPULoad.tsx b/src/components/deviceCPULoad.tsx index cbd03b40..7b7e4099 100644 --- a/src/components/deviceCPULoad.tsx +++ b/src/components/deviceCPULoad.tsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react' -import MyResponsiveLine from './StandardLineChart' +import StandartLineChart from './StandardLineChart' import ShadowBox from './ShadowBox' import IconText from './IconText' import { Paragraph, Separator, XStack, YStack } from 'tamagui' @@ -56,17 +56,18 @@ const data = [ }, { x: '12', - y: 5, + y: 132, }, ], }, ] const DeviceCPULoad = () => { const [message, setMessage] = useState('') - const currentLoad = { y: 9 } + const currentLoad = data[0].data[data[0].data.length - 1].y + console.log(currentLoad) useEffect(() => { - currentLoad.y > 80 ? setMessage('Good') : setMessage('Poor') + currentLoad < 80 ? setMessage('Good') : setMessage('Poor') }, [currentLoad]) console.log(currentLoad) @@ -81,7 +82,7 @@ const DeviceCPULoad = () => { }} >
- +
@@ -89,7 +90,7 @@ const DeviceCPULoad = () => { CPU - {currentLoad.y} GB + {currentLoad} GB {message} @@ -97,7 +98,7 @@ const DeviceCPULoad = () => { - {'Good'} + {message} {/*THIS IS USED FOR ADDITIONAL TEXT {'GOod'} */}