diff --git a/Front-end/src/components/BoutonGraphique.jsx b/Front-end/src/components/BoutonGraphique.jsx index 932725f..04c7599 100644 --- a/Front-end/src/components/BoutonGraphique.jsx +++ b/Front-end/src/components/BoutonGraphique.jsx @@ -1,23 +1,21 @@ -import React, {useRef} from "react"; +import React from "react"; import { ChartLine } from "lucide-react"; -function BoutonGraphique({ TypeAff, setAffichage,graphCible}) { - const handleClick = (newAffichage) =>{ - setAffichage(newAffichage); - if(graphCible.current){ - graphCible.current.scrollIntoView({ behavior: "smooth" }); - } + +function BoutonGraphique({ type, setGraphStates, graphStates, graphCible }) { + const handleClick = () => { + setGraphStates((prev) => ({ ...prev, [type]: !prev[type] })); }; - return !TypeAff ? ( + return !graphStates[type] ? ( ) : ( diff --git a/Front-end/src/components/InfoObject.jsx b/Front-end/src/components/InfoObject.jsx index 9c16424..b838a53 100644 --- a/Front-end/src/components/InfoObject.jsx +++ b/Front-end/src/components/InfoObject.jsx @@ -3,8 +3,8 @@ import { Info } from "lucide-react"; function InfoObject({ object,defafficherModif }) { return ( -
Chargement des données...
- )} - {object && object.id ? ( -Chargement des données...
- )} +Chargement des données...
- ))} - {AffTempGraph && - (object && object.id ? ( -Chargement des données...
- ))} - {AffPressionGraph && - (object && object.id ? ( -Chargement des données...
- ))} - {AffHumiditeGraph && - (object && object.id ? ( -Chargement des données...
- ))} + + {graphStates.wind &&