Home.tsx 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import React, { useContext, ChangeEvent, FC } from "react";
  2. import Select from "../UI/forms/select";
  3. // import DegreeDay from "../data/DegreeDay";
  4. // import TemperaturePerSeason from "../data/TemperaturePerSeason";
  5. import TemperaturePerSector from "../data/TemperaturePerSector";
  6. // import Precipitation from "../data/Precipitation";
  7. import CalendarInput from "../UI/forms/calendarInput";
  8. import { UserStateContext } from "../../context/auth/AuthProvider";
  9. import DashboardProvider from "../../context/dashboard/Provider";
  10. import { Redirect } from "react-router-dom";
  11. import Layout from "../layout";
  12. const Home: FC = () => {
  13. let fincaList: string[] | number[] = ["a", "b", "c", "d"];
  14. let campaignList: string[] | number[] = ["2018", "2019", "2020", "2021"];
  15. const userState = useContext(UserStateContext);
  16. if (!userState.loggedIn) {
  17. return <Redirect to="/login" />;
  18. }
  19. return (
  20. <>
  21. <Layout>
  22. <DashboardProvider>
  23. <section className="row p-lg-4 p-md-3 p-2">
  24. <div className="col-12 col-lg-4 mb-2 col-xl-3 mb-xl-0">
  25. <Select
  26. list={fincaList}
  27. onChange={(e: ChangeEvent<HTMLInputElement>) =>
  28. console.log(e.target.value)
  29. }
  30. name="Comparación"
  31. placeholder="Fincas"
  32. />
  33. </div>
  34. <div className="col-6 col-lg-4 mb-2 col-xl-auto mb-xl-0">
  35. <CalendarInput
  36. onChange={(e: ChangeEvent<HTMLInputElement>) =>
  37. console.log(e.target.value)
  38. }
  39. name="Comparación"
  40. />
  41. </div>
  42. <div className="col-6 col-lg-4 mb-2 col-xl-auto mb-xl-0">
  43. <CalendarInput
  44. onChange={(e: ChangeEvent<HTMLInputElement>) =>
  45. console.log(e.target.value)
  46. }
  47. name="Comparación"
  48. />
  49. </div>
  50. <div className="col-6 col-lg-4 mb-2 col-xl-auto mb-xl-0">
  51. <Select
  52. list={campaignList}
  53. onChange={(e: ChangeEvent<HTMLInputElement>) =>
  54. console.log(e.target.value)
  55. }
  56. name="Comparación"
  57. placeholder="Año historicos"
  58. />
  59. </div>
  60. <div className="col-auto">
  61. <button type="button" className="btn btn-primary">
  62. Aplicar
  63. </button>
  64. </div>
  65. </section>
  66. <section className="row">
  67. {/* <div className="col-xl-6"> */}
  68. {/* <TemperaturePerSeason /> */}
  69. {/* <DegreeDay */}
  70. {/* title={"Vista flores"} */}
  71. {/* periodString={"1ro Octubre - 31 Marzo"} */}
  72. {/* /> */}
  73. {/* <Precipitation */}
  74. {/* title={"Maipú"} */}
  75. {/* periodString={"1ro Octubre - 31 Marzo"} */}
  76. {/* /> */}
  77. {/* </div> */}
  78. <div className="col-xl-6">
  79. <TemperaturePerSector />
  80. </div>
  81. </section>
  82. </DashboardProvider>
  83. </Layout>
  84. </>
  85. );
  86. };
  87. export default Home;