|
@@ -12,16 +12,16 @@ 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";
|
|
|
|
|
|
|
+import CheckboxTables from "../UI/dashboard/checkboxTables";
|
|
|
|
|
|
|
|
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)}}
|
|
|
|
|
|
|
+ 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) {
|
|
if (!userState.loggedIn) {
|
|
|
return <Redirect to="/login" />;
|
|
return <Redirect to="/login" />;
|
|
@@ -38,23 +38,23 @@ const Home: FC = () => {
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
|
|
|
|
|
- <Checkbox changeSeason={changeSeason} changeDegree={changeDegree} changePrep={changePrep}/>
|
|
|
|
|
|
|
+ <CheckboxTables changeSeason={toggleSeason} changeDegree={toggleDegree} changePrep={togglePrep}/>
|
|
|
|
|
|
|
|
- { getViewSeasonState ?
|
|
|
|
|
|
|
+ { viewSeasonState ?
|
|
|
<section className="row">
|
|
<section className="row">
|
|
|
<div className="col-xl-8">
|
|
<div className="col-xl-8">
|
|
|
<GeneralPerSeason />
|
|
<GeneralPerSeason />
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
: null }
|
|
: null }
|
|
|
- { getViewDegreeState ?
|
|
|
|
|
|
|
+ { viewDegreeState ?
|
|
|
<section className="row">
|
|
<section className="row">
|
|
|
<div className="col-xl-8">
|
|
<div className="col-xl-8">
|
|
|
<DegreeDay title="hola" periodString="0/0/0" />
|
|
<DegreeDay title="hola" periodString="0/0/0" />
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
: null }
|
|
: null }
|
|
|
- { getViewPrepState ?
|
|
|
|
|
|
|
+ { viewPrepState ?
|
|
|
<section className="row">
|
|
<section className="row">
|
|
|
<div className="col-xl-8">
|
|
<div className="col-xl-8">
|
|
|
<Precipitation title="hola" periodString="0/0/0" />
|
|
<Precipitation title="hola" periodString="0/0/0" />
|