esLint
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setSelectedChartData } from "../../../../../redux/slices/selectedChartDataSlice";
|
||||
|
||||
const useChartData = (loopMeasurementCurveChartData: any) => {
|
||||
const useChartData = (loopMeasurementCurveChartData: unknown) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
// components/main/kabelueberwachung/kue705FO/hooks/useChartPlugin.ts
|
||||
import { useState, useEffect } from "react";
|
||||
import { Plugin } from "chart.js";
|
||||
import Chart from "chart.js/auto";
|
||||
|
||||
const useChartPlugin = () => {
|
||||
const [zoomPlugin, setZoomPlugin] = useState<any>(null);
|
||||
const [zoomPlugin, setZoomPlugin] = useState<Plugin | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
|
||||
@@ -4,13 +4,13 @@ import { getAlarmDisplayText } from "../../../../../utils/alarmUtils";
|
||||
|
||||
const useIsoDisplay = (
|
||||
slotIndex: number,
|
||||
kuePSTmMinus96V: any,
|
||||
kueCableBreak: any,
|
||||
kueGroundFault: any,
|
||||
kueAlarm1: any,
|
||||
kueAlarm2: any,
|
||||
kueOverflow: any,
|
||||
isolationswert: any,
|
||||
kuePSTmMinus96V: boolean,
|
||||
kueCableBreak: boolean,
|
||||
kueGroundFault: boolean,
|
||||
kueAlarm1: boolean,
|
||||
kueAlarm2: boolean,
|
||||
kueOverflow: boolean,
|
||||
isolationswert: number,
|
||||
isoDisplayText: string,
|
||||
groundFaultDisplayText: string,
|
||||
isoFaultDisplayText: string,
|
||||
@@ -25,12 +25,12 @@ const useIsoDisplay = (
|
||||
setIsoDisplayValue(
|
||||
getAlarmDisplayText(
|
||||
slotIndex,
|
||||
kuePSTmMinus96V,
|
||||
kueCableBreak,
|
||||
kueGroundFault,
|
||||
kueAlarm1,
|
||||
kueAlarm2,
|
||||
kueOverflow ?? undefined,
|
||||
[kuePSTmMinus96V ? 1 : 0],
|
||||
[kueCableBreak ? 1 : 0],
|
||||
[kueGroundFault ? 1 : 0],
|
||||
[kueAlarm1 ? 1 : 0],
|
||||
[kueAlarm2 ? 1 : 0],
|
||||
[kueOverflow ? 1 : 0],
|
||||
isolationswert,
|
||||
isoDisplayText,
|
||||
groundFaultDisplayText,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// components/main/kabelueberwachung/kue705FO/hooks/useKueVersion.ts
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const useKueVersion = (slotIndex: number, reduxKueVersion: any) => {
|
||||
const useKueVersion = (slotIndex: number, reduxKueVersion: number[]) => {
|
||||
const [kueVersion, setKueVersion] = useState("V4.19");
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
// components/main/kabelueberwachung/kue705FO/hooks/useTDRChart.ts
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import Chart from "chart.js/auto";
|
||||
import { createTDRChart } from "../../../../../utils/chartUtils";
|
||||
|
||||
const useTDRChart = (selectedChartData: any) => {
|
||||
const chartInstance = useRef<Chart | null>(null);
|
||||
type ZoomPluginType = { id: string } | null;
|
||||
|
||||
const useChartPlugin = () => {
|
||||
const [zoomPlugin, setZoomPlugin] = useState<ZoomPluginType>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedChartData) {
|
||||
createTDRChart(selectedChartData); // Neues Chart erstellen
|
||||
if (typeof window !== "undefined") {
|
||||
import("chartjs-plugin-zoom").then((mod) => {
|
||||
setZoomPlugin(mod.default);
|
||||
Chart.register(mod.default);
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return () => {
|
||||
// Cleanup beim Komponentenwechsel
|
||||
if (chartInstance.current) {
|
||||
console.log("Chart wird beim Komponentenwechsel zerstört.");
|
||||
chartInstance.current.destroy();
|
||||
chartInstance.current = null;
|
||||
}
|
||||
};
|
||||
}, [selectedChartData]);
|
||||
|
||||
return { chartInstance };
|
||||
return zoomPlugin;
|
||||
};
|
||||
|
||||
export default useTDRChart;
|
||||
export default useChartPlugin;
|
||||
|
||||
Reference in New Issue
Block a user