TDR Distance auf Display anzeigen
This commit is contained in:
@@ -147,12 +147,24 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
||||
slotIndex,
|
||||
modulName
|
||||
);
|
||||
//---------------------------------
|
||||
//---------------------------------
|
||||
const tdmChartData = useSelector((state: RootState) => state.tdmChart.data);
|
||||
const latestTdrDistanceMeters =
|
||||
Array.isArray(tdmChartData?.[slotIndex]) &&
|
||||
tdmChartData[slotIndex].length > 0 &&
|
||||
typeof tdmChartData[slotIndex][0].d === "number"
|
||||
? tdmChartData[slotIndex][0].d
|
||||
: 0;
|
||||
|
||||
const latestTdrDistance = Number((latestTdrDistanceMeters / 1000).toFixed(3));
|
||||
//setLoopDisplayValue(latestTdrDistance);
|
||||
|
||||
//---------------------------------
|
||||
|
||||
const loopValue =
|
||||
activeButton === "TDR"
|
||||
? Array.isArray(tdrLocation) && typeof tdrLocation[slotIndex] === "number"
|
||||
? tdrLocation[slotIndex]
|
||||
: 0
|
||||
? latestTdrDistance
|
||||
: typeof schleifenwiderstand === "number"
|
||||
? schleifenwiderstand
|
||||
: Number(schleifenwiderstand);
|
||||
@@ -166,6 +178,7 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
||||
const { chartInstance } = useTDRChart(selectedChartData);
|
||||
|
||||
//---------------------------------
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative bg-gray-300 w-[7.25rem] h-[24.375rem] border border-gray-400 transform laptop:-translate-y-12 2xl:-translate-y-0
|
||||
@@ -310,21 +323,22 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
||||
Schleife
|
||||
</button>
|
||||
<button
|
||||
onClick={() =>
|
||||
handleButtonClick(
|
||||
"TDR",
|
||||
setActiveButton,
|
||||
setloopTitleText,
|
||||
(value) =>
|
||||
setLoopDisplayValue(
|
||||
typeof value === "number" ? value : Number(value)
|
||||
), // Hier sicherstellen, dass nur number übergeben wird
|
||||
Number(schleifenwiderstand), // <- Stelle sicher, dass es eine Zahl ist
|
||||
tdrLocation,
|
||||
slotIndex,
|
||||
dispatch
|
||||
)
|
||||
}
|
||||
onClick={() => {
|
||||
setActiveButton("TDR");
|
||||
setloopTitleText("Entfernung [Km]");
|
||||
|
||||
const latestTdrDistanceMeters =
|
||||
Array.isArray(tdmChartData?.[slotIndex]) &&
|
||||
tdmChartData[slotIndex].length > 0 &&
|
||||
typeof tdmChartData[slotIndex][0].d === "number"
|
||||
? tdmChartData[slotIndex][0].d
|
||||
: 0;
|
||||
|
||||
const latestTdrDistance = Number(
|
||||
(latestTdrDistanceMeters / 1000).toFixed(3)
|
||||
);
|
||||
setLoopDisplayValue(latestTdrDistance);
|
||||
}}
|
||||
className={`w-[50%] h-[1.563rem] text-white text-[0.625rem] flex items-center justify-center ${
|
||||
Array.isArray(tdrActive) && tdrActive[slotIndex] === 0
|
||||
? "bg-gray-200 cursor-not-allowed" // Deaktiviert: Hellgrau
|
||||
|
||||
Reference in New Issue
Block a user