From 80d2571a2696bac68a136b3b051c5fa3257684c5 Mon Sep 17 00:00:00 2001 From: Julian <63585974+ScoutAtlas@users.noreply.github.com> Date: Thu, 24 Jun 2021 19:57:37 +0200 Subject: [PATCH] Cleaning up code and fixed table+charts Regarding #82 Fixed the table and chart components Fixed the getter Methods --- .vs/slnx.sqlite | Bin 487424 -> 487424 bytes frontend/package.json | 4 +- .../details/ColumnChartComponent.jsx | 30 ++++-------- .../src/components/details/NavbarComponent.js | 2 +- .../components/details/PieChartComponent.jsx | 18 ++----- .../components/details/ScenarioComponent.js | 8 ++-- .../src/components/details/TableComponent.jsx | 44 +++++++----------- frontend/src/interface/processBackendData.js | 23 ++++----- frontend/src/interface/projectInterface.js | 25 ++-------- 9 files changed, 51 insertions(+), 103 deletions(-) diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 52aa99023eca092f3ffa0c9f9384d1e127c20767..559115f961c6274e3a9be30cbcd2f5e547d31aab 100644 GIT binary patch delta 116 zcmZp8AlvXjc7ilx%|sbz#+r=@t5&e;JgNFKWitOtWmYpQ)|+=Hn*&+qI$6yJHpj1g z&d6$Z<>Se{lf73@VztnB-g0H~qty+pX7_rgM{Q1DV-J*etob{&dG*@%)oU4nmqHr6M%Il9t5&cI2I`->Gns#-GOJvK@@(VD=0KK|LeRg-o8wnL zXJnPnR7lu1*?aXQR+*Q(ijyZlTHU}Z=%xR0{pR#F_Kd7D6IzTynpdxFU%i$Qh?#(x Q8Hibcn05Q=wQQk>06n2E?*IS* diff --git a/frontend/package.json b/frontend/package.json index e31d4c6c..a03d2bf7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,7 +7,7 @@ "@material-ui/core": "^4.11.4", "@react-pdf/renderer": "^2.0.12", "@reduxjs/toolkit": "^1.6.0", - "apexcharts": "^3.26.1", + "apexcharts": "^3.27.1", "axios": "^0.21.1", "cors": "^2.8.5", "html2canvas": "^1.0.0-rc.7", @@ -58,7 +58,7 @@ "@testing-library/react": "^11.2.7", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.6", - "gh-pages": "^2.2.0", + "gh-pages": "^3.2.3", "identity-obj-proxy": "^3.0.0", "jest": "26.6.0", "jest-transform-stub": "^2.0.0", diff --git a/frontend/src/components/details/ColumnChartComponent.jsx b/frontend/src/components/details/ColumnChartComponent.jsx index 711b8ae7..12f2efe4 100644 --- a/frontend/src/components/details/ColumnChartComponent.jsx +++ b/frontend/src/components/details/ColumnChartComponent.jsx @@ -1,4 +1,4 @@ -import { React, useState, useEffect } from 'react'; +import { React } from 'react'; import ReactApexChart from 'react-apexcharts'; import { getColumnChartData, getLifeCycleStages } from 'interface/projectInterface'; @@ -7,18 +7,7 @@ import { getColumnChartData, getLifeCycleStages } from 'interface/projectInterfa * */ const ColumnChartComponent = () => { - const [values, setValues] = useState([]); - const [isLoading, setLoading] = useState(true); - - useEffect(() => { - const fetchData = async () => { - const values = Array.from(getColumnChartData()); - setValues(values); - setLoading(false); - }; - fetchData(); - }, []); - + const values = getColumnChartData(); const series = [ { name: 'Global warming in kg CO2 equivalents', @@ -92,15 +81,12 @@ const ColumnChartComponent = () => { ] } }; - if (isLoading) { - return
Loading ...
; - } else { - return ( -
- -
- ); - } + + return ( +
+ +
+ ); }; export default ColumnChartComponent; diff --git a/frontend/src/components/details/NavbarComponent.js b/frontend/src/components/details/NavbarComponent.js index b9ab61e6..b576c52e 100644 --- a/frontend/src/components/details/NavbarComponent.js +++ b/frontend/src/components/details/NavbarComponent.js @@ -18,7 +18,7 @@ const NavbarComponent = (props) => {
history.goBack()}> -