diff --git a/src/components/LayoutComponent/LandingPage.tsx b/src/components/LayoutComponent/LandingPage.tsx index 389853f8..f17ff1d1 100644 --- a/src/components/LayoutComponent/LandingPage.tsx +++ b/src/components/LayoutComponent/LandingPage.tsx @@ -1,7 +1,7 @@ import LayoutComponent from './LayoutComponent' import './LandingPage.css' import QuickStartBar from '../QuickStartBar/QuickStartBar' -import StatisticBox from '../StaticBox' +import DeviceCPULoad from '../deviceCPULoad' function LandingPage() { return ( @@ -96,12 +96,7 @@ function Content() { Discover Nodes - + ) } diff --git a/src/components/StandardLineChart.tsx b/src/components/StandardLineChart.tsx index 11ea8fad..79bc221d 100644 --- a/src/components/StandardLineChart.tsx +++ b/src/components/StandardLineChart.tsx @@ -1,67 +1,23 @@ import { ResponsiveLine } from '@nivo/line' +interface DataPoint { + x: string + y: number +} -const MyResponsiveLine = () => { - const data = [ - { - id: 'japan', - color: '#8DC6BC', - data: [ - { - x: '1', - y: 15, - }, - { - x: '2', - y: 12, - }, - { - x: '3', - y: 43, - }, - { - x: '4', - y: 20, - }, - { - x: '5', - y: 60, - }, - { - x: '6', - y: 5, - }, - { - x: '7', - y: 15, - }, - { - x: '8', - y: 12, - }, - { - x: '9', - y: 43, - }, - { - x: '10', - y: 20, - }, - { - x: '11', - y: 60, - }, - { - x: '12', - y: 5, - }, - ], - }, - ] +interface Serie { + id: string + data: DataPoint[] +} + +interface MyResponsiveLineProps { + data: Serie[] +} +const MyResponsiveLine = ({ data }: MyResponsiveLineProps) => { return ( = ({ - title, - memory, - stateIcon, - stateText, - additionalStateText, - children, - ...props -}) => { - return ( - - - -
- -
- - - - {title} - - - {memory} - - - {children} -
- - - {stateText} - {additionalStateText && {additionalStateText}} - -
-
- ) -} - -export default StatisticBox diff --git a/src/components/deviceCPULoad.tsx b/src/components/deviceCPULoad.tsx new file mode 100644 index 00000000..cbd03b40 --- /dev/null +++ b/src/components/deviceCPULoad.tsx @@ -0,0 +1,109 @@ +import { useState, useEffect } from 'react' + +import MyResponsiveLine from './StandardLineChart' +import ShadowBox from './ShadowBox' +import IconText from './IconText' +import { Paragraph, Separator, XStack, YStack } from 'tamagui' + +const data = [ + { + id: 'cpu', + color: '#8DC6BC', + data: [ + { + x: '1', + y: 15, + }, + { + x: '2', + y: 12, + }, + { + x: '3', + y: 43, + }, + { + x: '4', + y: 20, + }, + { + x: '5', + y: 60, + }, + { + x: '6', + y: 5, + }, + { + x: '7', + y: 15, + }, + { + x: '8', + y: 12, + }, + { + x: '9', + y: 43, + }, + { + x: '10', + y: 20, + }, + { + x: '11', + y: 60, + }, + { + x: '12', + y: 5, + }, + ], + }, +] +const DeviceCPULoad = () => { + const [message, setMessage] = useState('') + const currentLoad = { y: 9 } + + useEffect(() => { + currentLoad.y > 80 ? setMessage('Good') : setMessage('Poor') + }, [currentLoad]) + + console.log(currentLoad) + return ( + + + +
+ +
+ + + + CPU + + + {currentLoad.y} GB + + + {message} +
+ + + + {'Good'} + + {/*THIS IS USED FOR ADDITIONAL TEXT {'GOod'} */} + +
+
+ ) +} + +export default DeviceCPULoad