feat: Dynamische Anzeige im LoopDisplay zwischen Schleifenwiderstand und TDR-Entfernung hinzugefügt

- loopDisplay zeigt nun den Schleifenwiderstand oder die TDR-Entfernung an, basierend auf dem aktiven Button ("Schleife" oder "TDR").
- Der Button "Schleife" setzt den Wert im loopDisplay auf den Schleifenwiderstand.
- Der Button "TDR" setzt den Wert im loopDisplay auf die Entfernung (tdrLocation).
This commit is contained in:
ISA
2024-11-05 13:40:02 +01:00
parent 442b553aa7
commit 344f4bdb75

View File

@@ -22,6 +22,8 @@ function Kue705FO({
const [loopTitleText, setloopTitleText] = useState(
"Schleifenwiderstand [kOhm]"
);
const [loopDisplayValue, setLoopDisplayValue] = useState(schleifenwiderstand); // Initialisiere den loopDisplayValue mit schleifenwiderstand
const [isoDisplayText, setIsoDisplayText] = useState("Aderbruch");
const [groundFaultDisplayText, setGroundFaultDisplayText] =
useState("Erdschluss");
@@ -66,13 +68,12 @@ function Kue705FO({
if (button === "Schleife") {
setActiveButton("Schleife");
setloopTitleText("Schleifenwiderstand [kOhm]");
setCurrentDisplayValue(schleifenwiderstand || "0");
} else if (button === "TDR") {
setActiveButton("TDR");
setloopTitleText("Entfernung [Km]");
setCurrentDisplayValue(tdrLocation || "0");
}
};
// Funktion für die Schleifenmessung
const goLoop = () => {
let slot = slotIndex;
@@ -106,17 +107,6 @@ function Kue705FO({
};
// Funktion für die TDR-Messung
const goTDR = () => {
//-------------------------------------------------
/* const [isClient, setIsClient] = useState(false);
useEffect(() => {
// This will only run in the client/browser, not on the server
setIsClient(true);
}, []);
if (!isClient) {
return null; // or a loading spinner
} */
//-------------------------------------------------
let slot = slotIndex;
@@ -340,7 +330,7 @@ function Kue705FO({
<span className="text-white text-[10px]">Alarm</span>
</div>
</div>
{/* Anzeige des Isolation */}
<div className="relative mt-[50px] mx-auto bg-black text-white w-[100px] h-[40px] flex items-center justify-center text-[18px] z-10">
<div className="text-center">
<span
@@ -399,7 +389,10 @@ function Kue705FO({
<div className="absolute bottom-[5px] left-1/2 transform -translate-x-1/2 w-[100px] flex justify-center items-center">
<div className="text-center text-black text-[10px]">
<p>{schleifenwiderstand + " KOhm"}</p>
<p>
{loopDisplayValue +
(activeButton === "Schleife" ? " KOhm" : " Km")}
</p>
</div>
</div>
</div>