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