// components/main/kabelueberwachung/kue705FO/kue705FO-Funktionen/handleButtonClick.ts import { Dispatch } from "react"; import { setActiveMode } from "../../../../../redux/slices/chartDataSlice"; const handleButtonClick = ( button: "Schleife" | "TDR", setActiveButton: Dispatch>, setLoopTitleText: Dispatch>, setLoopDisplayValue: Dispatch>, schleifenwiderstand: number, tdrLocation: number[] | undefined, slotIndex: number, dispatch: Dispatch ) => { if (button === "Schleife") { setActiveButton("Schleife"); setLoopTitleText("Schleifenwiderstand [kOhm]"); setLoopDisplayValue(schleifenwiderstand); dispatch(setActiveMode("Schleife")); } else if (button === "TDR") { setActiveButton("TDR"); setLoopTitleText("Entfernung [Km]"); setLoopDisplayValue( tdrLocation && tdrLocation[slotIndex] !== undefined ? tdrLocation[slotIndex] : "0" ); dispatch(setActiveMode("TDR")); } }; export default handleButtonClick;