|
|
@@ -1,16 +1,27 @@
|
|
|
-import React, { useContext, FC } from "react";
|
|
|
+import React, { useContext, FC, useState } from "react";
|
|
|
// import DegreeDay from "../data/DegreeDay";
|
|
|
// import TemperaturePerSeason from "../data/TemperaturePerSeason";
|
|
|
import GeneralPerSector from "../data/GeneralPerSector";
|
|
|
+import GeneralPerSeason from "../data/GeneralPerSeason";
|
|
|
+import DegreeDay from "../data/DegreeDay";
|
|
|
+import HeatMap from "../data/HeatMap";
|
|
|
+import Precipitation from "../data/Precipitation";
|
|
|
// import Precipitation from "../data/Precipitation";
|
|
|
import { UserStateContext } from "../../context/auth/AuthProvider";
|
|
|
import DashboardProvider from "../../context/dashboard/Provider";
|
|
|
import { Redirect } from "react-router-dom";
|
|
|
import Layout from "../layout";
|
|
|
import Cockpit from "../UI/dashboard/cockpit";
|
|
|
+import CheckboxTables from "../UI/dashboard/checkboxTables";
|
|
|
|
|
|
const Home: FC = () => {
|
|
|
const userState = useContext(UserStateContext);
|
|
|
+ const [viewSeasonState, setViewSeasonState] = useState<Boolean>(false);
|
|
|
+ const [viewDegreeState, setViewDegreeState] = useState<Boolean>(false);
|
|
|
+ const [viewPrepState, setViewPrepState] = useState<Boolean>(false);
|
|
|
+ const toggleSeason = () => setViewSeasonState(!viewSeasonState)
|
|
|
+ const toggleDegree = () => setViewDegreeState(!viewDegreeState)
|
|
|
+ const togglePrep = () => setViewPrepState(!viewPrepState)
|
|
|
|
|
|
if (!userState.loggedIn) {
|
|
|
return <Redirect to="/login" />;
|
|
|
@@ -26,6 +37,31 @@ const Home: FC = () => {
|
|
|
<GeneralPerSector />
|
|
|
</div>
|
|
|
</section>
|
|
|
+
|
|
|
+ <CheckboxTables changeSeason={toggleSeason} changeDegree={toggleDegree} changePrep={togglePrep}/>
|
|
|
+
|
|
|
+ { viewSeasonState ?
|
|
|
+ <section className="row">
|
|
|
+ <div className="col-xl-8">
|
|
|
+ <GeneralPerSeason />
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ : null }
|
|
|
+ { viewDegreeState ?
|
|
|
+ <section className="row">
|
|
|
+ <div className="col-xl-8">
|
|
|
+ <DegreeDay title="hola" periodString="0/0/0" />
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ : null }
|
|
|
+ { viewPrepState ?
|
|
|
+ <section className="row">
|
|
|
+ <div className="col-xl-8">
|
|
|
+ <Precipitation title="hola" periodString="0/0/0" />
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+ : null }
|
|
|
+
|
|
|
</DashboardProvider>
|
|
|
</Layout>
|
|
|
</>
|