diff --git a/package.json b/package.json index 893abbce..11b8adb9 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "react-dom": "18" }, "dependencies": { + "@nivo/line": "^0.83.0", "@nivo/pie": "^0.83.0", "@status-im/components": "^0.2.6", "@tamagui/config": "1.36.4", diff --git a/src/components/DeviceCPULoad.tsx b/src/components/DeviceCPULoad.tsx new file mode 100644 index 00000000..b7736398 --- /dev/null +++ b/src/components/DeviceCPULoad.tsx @@ -0,0 +1,70 @@ +import StandartLineChart from './StandardLineChart' +import ShadowBox from './ShadowBox' +import IconText from './IconText' +import { Paragraph, Separator, XStack, YStack } from 'tamagui' + +type DataPoint = { + x: number + y: number +} + +type ChartData = { + id: string + color: string + data: DataPoint[] +} + +type DeviceCPULoadProps = { + load: number[] +} +const DeviceCPULoad: React.FC = ({ load }) => { + const chartData: ChartData[] = [ + { + id: 'cpu', + color: '#8DC6BC', + data: load.map((yValue, index: number) => ({ + x: index + 1, + y: yValue, + })), + }, + ] + const currentLoad = + chartData[0].data.length > 0 ? chartData[0].data[chartData[0].data.length - 1].y : 0 + + const message = currentLoad < 80 ? 'Good' : 'Poor' + + return ( + + + +
+ +
+ + + CPU + + + {currentLoad} GB + + +
+ + + + {message} + + {/* This is additional text */} + +
+
+ ) +} + +export default DeviceCPULoad diff --git a/src/components/IconText.tsx b/src/components/IconText.tsx index 53069fbb..1fa15f68 100644 --- a/src/components/IconText.tsx +++ b/src/components/IconText.tsx @@ -15,7 +15,7 @@ const IconText = ({ icon, children, ...props }: IconTextProps) => { space={'$2'} > - + {children} diff --git a/src/components/LayoutComponent/LandingPage.tsx b/src/components/LayoutComponent/LandingPage.tsx index 6d0b436c..5a770a92 100644 --- a/src/components/LayoutComponent/LandingPage.tsx +++ b/src/components/LayoutComponent/LandingPage.tsx @@ -1,6 +1,7 @@ import LayoutComponent from './LayoutComponent' import './LandingPage.css' import QuickStartBar from '../QuickStartBar/QuickStartBar' +import DeviceCPULoad from '../DeviceCPULoad' import NodesLogo from '../NodesLogo' function LandingPage() { @@ -89,6 +90,7 @@ function Content() { Discover Nodes + ) } diff --git a/src/components/ShadowBox.tsx b/src/components/ShadowBox.tsx index d427a493..ce14ff83 100644 --- a/src/components/ShadowBox.tsx +++ b/src/components/ShadowBox.tsx @@ -2,17 +2,18 @@ import { ReactNode } from 'react' import { Stack } from 'tamagui' type ShadowBoxProps = { + boxStyle?: React.CSSProperties children: ReactNode } -const ShadowBox = ({ children }: ShadowBoxProps) => { +const ShadowBox = ({boxStyle, children }: ShadowBoxProps) => { return ( {children} diff --git a/src/components/StandardLineChart.tsx b/src/components/StandardLineChart.tsx new file mode 100644 index 00000000..43aee4ee --- /dev/null +++ b/src/components/StandardLineChart.tsx @@ -0,0 +1,46 @@ +import { ResponsiveLine } from '@nivo/line' +interface DataPoint { + x: number + y: number +} + +interface ChartData { + id: string + data: DataPoint[] +} + +interface StandartLineChartProps { + data: ChartData[] +} +const StandartLineChart = ({ data }: StandartLineChartProps) => { + return ( + + ) +} +export default StandartLineChart diff --git a/yarn.lock b/yarn.lock index 8efe1b20..848b3e01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2672,6 +2672,22 @@ __metadata: languageName: node linkType: hard +"@nivo/annotations@npm:0.83.0": + version: 0.83.0 + resolution: "@nivo/annotations@npm:0.83.0" + dependencies: + "@nivo/colors": 0.83.0 + "@nivo/core": 0.83.0 + "@react-spring/web": 9.4.5 || ^9.7.2 + "@types/prop-types": ^15.7.2 + lodash: ^4.17.21 + prop-types: ^15.7.2 + peerDependencies: + react: ">= 16.14.0 < 19.0.0" + checksum: 8d7b6fc8b9d8d3a31e661138b3af3e56639fd2e26ddbde2947f986adc0aaba55c684a581a24f5124d0852074ab631b6690c1a859e2e80c7470ed8d975851bf19 + languageName: node + linkType: hard + "@nivo/arcs@npm:0.83.0": version: 0.83.0 resolution: "@nivo/arcs@npm:0.83.0" @@ -2687,6 +2703,25 @@ __metadata: languageName: node linkType: hard +"@nivo/axes@npm:0.83.0": + version: 0.83.0 + resolution: "@nivo/axes@npm:0.83.0" + dependencies: + "@nivo/core": 0.83.0 + "@nivo/scales": 0.83.0 + "@react-spring/web": 9.4.5 || ^9.7.2 + "@types/d3-format": ^1.4.1 + "@types/d3-time-format": ^2.3.1 + "@types/prop-types": ^15.7.2 + d3-format: ^1.4.4 + d3-time-format: ^3.0.0 + prop-types: ^15.7.2 + peerDependencies: + react: ">= 16.14.0 < 19.0.0" + checksum: bb96372d026407f5ce3ae1503200955d576f9ba49c49f595b32cbef5aabaacb97068aecb5f08445aa92ec6205cf14364d7a2ad9a58c4ef839b347a61ca1739a9 + languageName: node + linkType: hard + "@nivo/colors@npm:0.83.0": version: 0.83.0 resolution: "@nivo/colors@npm:0.83.0" @@ -2746,6 +2781,27 @@ __metadata: languageName: node linkType: hard +"@nivo/line@npm:^0.83.0": + version: 0.83.0 + resolution: "@nivo/line@npm:0.83.0" + dependencies: + "@nivo/annotations": 0.83.0 + "@nivo/axes": 0.83.0 + "@nivo/colors": 0.83.0 + "@nivo/core": 0.83.0 + "@nivo/legends": 0.83.0 + "@nivo/scales": 0.83.0 + "@nivo/tooltip": 0.83.0 + "@nivo/voronoi": 0.83.0 + "@react-spring/web": 9.4.5 || ^9.7.2 + d3-shape: ^1.3.5 + prop-types: ^15.7.2 + peerDependencies: + react: ">= 16.14.0 < 19.0.0" + checksum: 9fcec539498aca10e6c13feed2595361a8800d52c286f497786cbedda33550220bda6c645e3203a0fd45c77efc7a43b712512baaa6aad6eeb47b81074cf3f8a1 + languageName: node + linkType: hard + "@nivo/pie@npm:^0.83.0": version: 0.83.0 resolution: "@nivo/pie@npm:0.83.0" @@ -2777,6 +2833,21 @@ __metadata: languageName: node linkType: hard +"@nivo/scales@npm:0.83.0": + version: 0.83.0 + resolution: "@nivo/scales@npm:0.83.0" + dependencies: + "@types/d3-scale": ^3.2.3 + "@types/d3-time": ^1.1.1 + "@types/d3-time-format": ^3.0.0 + d3-scale: ^3.2.3 + d3-time: ^1.0.11 + d3-time-format: ^3.0.0 + lodash: ^4.17.21 + checksum: fd14f73ee1daf9873c546710442c4c23828c8e65ab3ef6cf98ee48a6a1f07da3bde920d8a54c86f7eebd3c327ef3908cb4e36dea226626504bbf8f469f47fe61 + languageName: node + linkType: hard + "@nivo/tooltip@npm:0.83.0": version: 0.83.0 resolution: "@nivo/tooltip@npm:0.83.0" @@ -2787,6 +2858,21 @@ __metadata: languageName: node linkType: hard +"@nivo/voronoi@npm:0.83.0": + version: 0.83.0 + resolution: "@nivo/voronoi@npm:0.83.0" + dependencies: + "@nivo/core": 0.83.0 + "@types/d3-delaunay": ^5.3.0 + "@types/d3-scale": ^3.2.3 + d3-delaunay: ^5.3.0 + d3-scale: ^3.2.3 + peerDependencies: + react: ">= 16.14.0 < 19.0.0" + checksum: 0adf6c9b584f070165357e8d7b6382cd7b096e3376930a2ae2b848da8c7178045e58167ba701d8f31a50c37bd78ec77a252544096430ce060f7452e1ca383105 + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -6618,6 +6704,20 @@ __metadata: languageName: node linkType: hard +"@types/d3-delaunay@npm:^5.3.0": + version: 5.3.1 + resolution: "@types/d3-delaunay@npm:5.3.1" + checksum: bf0f15b7e2b305974fe4a62315b95339eee9ebc46cbdaf1c439927aab0ece8e8664e875fe4a84607e195ae8ddf35c747d54c8bef07d19f925b7172528032f215 + languageName: node + linkType: hard + +"@types/d3-format@npm:^1.4.1": + version: 1.4.2 + resolution: "@types/d3-format@npm:1.4.2" + checksum: aa70d25a3e2010bf3979044b438b8c387e6749a30d1cd95a37eac90e378a7b70bba4a6cce426d18dc936c95a95afe3b2efd2bb3c9a14bf0ce165a5b72f0aa09f + languageName: node + linkType: hard + "@types/d3-path@npm:^2": version: 2.0.2 resolution: "@types/d3-path@npm:2.0.2" @@ -6650,6 +6750,27 @@ __metadata: languageName: node linkType: hard +"@types/d3-time-format@npm:^2.3.1": + version: 2.3.1 + resolution: "@types/d3-time-format@npm:2.3.1" + checksum: 4c22f0454abc374a5a830ba6b84bed021a276cba44ad3ac0d611d1e152dc00ed54af62ce6f431675a2ea5f37f5ce86c05b096420a068caf855b989b269b68deb + languageName: node + linkType: hard + +"@types/d3-time-format@npm:^3.0.0": + version: 3.0.1 + resolution: "@types/d3-time-format@npm:3.0.1" + checksum: 9ec9156a6facb3e347db3b438938eaac5775a711916fe3667c883431df9b7bcf5d8fcbca7f538b7f0775d8b092c9cf18fe9c0deb7b1a9aa97fb675382a94c88b + languageName: node + linkType: hard + +"@types/d3-time@npm:^1.1.1": + version: 1.1.1 + resolution: "@types/d3-time@npm:1.1.1" + checksum: 5c859a2219fd9d4eeac7962eb981b6bb99a23044286fe093b247a98c72b4fe0ccd635cb0e9c4e4454fe56b8e655a26a414d3dd79bcb2074400ad6c2b1e78b633 + languageName: node + linkType: hard + "@types/d3-time@npm:^2": version: 2.1.1 resolution: "@types/d3-time@npm:2.1.1" @@ -8783,6 +8904,15 @@ __metadata: languageName: node linkType: hard +"d3-delaunay@npm:^5.3.0": + version: 5.3.0 + resolution: "d3-delaunay@npm:5.3.0" + dependencies: + delaunator: 4 + checksum: 3fa5ae167eb86e62ca0f9c3e8d05470b23572b4b480f05201705c0db976d403834cee1cdf264a41c97e45238e3999d48cc593f97d0da37229a42673a6bb10e95 + languageName: node + linkType: hard + "d3-format@npm:1 - 2": version: 2.0.0 resolution: "d3-format@npm:2.0.0" @@ -8863,6 +8993,13 @@ __metadata: languageName: node linkType: hard +"d3-time@npm:^1.0.11": + version: 1.1.0 + resolution: "d3-time@npm:1.1.0" + checksum: 33fcfff94ff093dde2048c190ecca8b39fe0ec8b3c61e9fc39c5f6072ce5b86dd2b91823f086366995422bbbac7f74fd9abdb7efe4f292a73b1c6197c699cc78 + languageName: node + linkType: hard + "date-fns@npm:^2.30.0": version: 2.30.0 resolution: "date-fns@npm:2.30.0" @@ -9022,6 +9159,13 @@ __metadata: languageName: node linkType: hard +"delaunator@npm:4": + version: 4.0.1 + resolution: "delaunator@npm:4.0.1" + checksum: a49f1c23edbcb79079a13577d32fcd46d0db30879c8484f742a0d840923085f2f3de35a9bfbb96eadd12201ffb7c3adf45b0f528d08b71cb547c5f8068b5d61b + languageName: node + linkType: hard + "delayed-stream@npm:~1.0.0": version: 1.0.0 resolution: "delayed-stream@npm:1.0.0" @@ -13555,6 +13699,7 @@ __metadata: resolution: "nimbus-gui@workspace:." dependencies: "@fsouza/prettierd": ^0.24.2 + "@nivo/line": ^0.83.0 "@nivo/pie": ^0.83.0 "@status-im/components": ^0.2.6 "@storybook/addon-essentials": ^7.2.0