esLint
This commit is contained in:
@@ -4,7 +4,14 @@ import React from "react";
|
||||
|
||||
interface CustomTooltipProps {
|
||||
active?: boolean;
|
||||
payload?: any[];
|
||||
payload?: Array<{
|
||||
dataKey: string;
|
||||
value: number;
|
||||
name?: string;
|
||||
color?: string;
|
||||
unit?: string;
|
||||
// Add other known properties here as needed
|
||||
}>;
|
||||
label?: string;
|
||||
unit?: string;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import React, { useEffect } from "react";
|
||||
import DatePicker from "react-datepicker";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { RootState } from "../../../../../../redux/store";
|
||||
import { RootState } from "@/redux/store";
|
||||
import {
|
||||
setVonDatum,
|
||||
setBisDatum,
|
||||
} from "../../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
} from "@/redux/slices/kabelueberwachungChartSlice";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
|
||||
const DateRangePicker: React.FC = () => {
|
||||
@@ -38,6 +38,7 @@ const DateRangePicker: React.FC = () => {
|
||||
useEffect(() => {
|
||||
if (!reduxVonDatum) dispatch(setVonDatum(formatISO(thirtyDaysAgo)));
|
||||
if (!reduxBisDatum) dispatch(setBisDatum(formatISO(today)));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [dispatch, reduxVonDatum, reduxBisDatum]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,24 +3,22 @@
|
||||
import React from "react";
|
||||
import DateRangePicker from "./DateRangePicker";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { RootState } from "../../../../../../redux/store";
|
||||
import { RootState } from "@/redux/store";
|
||||
import {
|
||||
setVonDatum,
|
||||
setBisDatum,
|
||||
setLoopMeasurementCurveChartData,
|
||||
setSelectedMode,
|
||||
setSelectedSlotType,
|
||||
setChartOpen,
|
||||
setFullScreen,
|
||||
setLoading,
|
||||
} from "../../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
import { setBrushRange } from "../../../../../../redux/slices/brushSlice";
|
||||
import { setChartTitle } from "../../../../../../redux/slices/loopChartTypeSlice";
|
||||
} from "@/redux/slices/kabelueberwachungChartSlice";
|
||||
import { setBrushRange } from "@/redux/slices/brushSlice";
|
||||
import { setChartTitle } from "@/redux/slices/loopChartTypeSlice";
|
||||
//-----------------------------------------------------------------------------------useLoopChartLoader
|
||||
export const useLoopChartLoader = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { vonDatum, bisDatum, selectedMode, selectedSlotType, slotNumber } =
|
||||
useSelector((state: RootState) => state.kabelueberwachungChartSlice);
|
||||
const hasShownNoDataAlert = React.useRef(false);
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
const [year, month, day] = dateString.split("-");
|
||||
@@ -77,7 +75,10 @@ export const useLoopChartLoader = () => {
|
||||
} else {
|
||||
dispatch(setLoopMeasurementCurveChartData([]));
|
||||
dispatch(setChartOpen(false));
|
||||
alert("⚠️ Keine Daten im gewählten Zeitraum.");
|
||||
if (!hasShownNoDataAlert.current) {
|
||||
alert("⚠️ Keine Messdaten im gewählten Zeitraum gefunden.");
|
||||
hasShownNoDataAlert.current = true; // ⬅️ Nur einmal zeigen
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("❌ Fehler beim Laden:", err);
|
||||
@@ -99,9 +100,9 @@ const LoopChartActionBar: React.FC = () => {
|
||||
bisDatum,
|
||||
selectedMode,
|
||||
selectedSlotType,
|
||||
isChartOpen,
|
||||
|
||||
slotNumber,
|
||||
loopMeasurementCurveChartData,
|
||||
|
||||
isLoading,
|
||||
} = useSelector((state: RootState) => state.kabelueberwachungChartSlice);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
"use client"; // /components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx
|
||||
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { RootState } from "../../../../../../redux/store";
|
||||
import { RootState } from "@/redux/store";
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
LineElement,
|
||||
@@ -32,8 +32,16 @@ ChartJS.register(
|
||||
import { getColor } from "../../../../../../utils/colors";
|
||||
import { PulseLoader } from "react-spinners";
|
||||
|
||||
const usePreviousData = (data: any[]) => {
|
||||
const ref = useRef<any[]>([]);
|
||||
type LoopMeasurementEntry = {
|
||||
t: string;
|
||||
i: number;
|
||||
m: number;
|
||||
g: number;
|
||||
a: number;
|
||||
};
|
||||
|
||||
const usePreviousData = (data: LoopMeasurementEntry[]) => {
|
||||
const ref = useRef<LoopMeasurementEntry[]>([]);
|
||||
useEffect(() => {
|
||||
ref.current = data;
|
||||
}, [data]);
|
||||
@@ -57,7 +65,10 @@ const LoopMeasurementChart = () => {
|
||||
const previousData = usePreviousData(loopMeasurementCurveChartData);
|
||||
|
||||
// Vergleichsfunktion
|
||||
const isEqual = (a: any[], b: any[]): boolean => {
|
||||
const isEqual = (
|
||||
a: LoopMeasurementEntry[],
|
||||
b: LoopMeasurementEntry[]
|
||||
): boolean => {
|
||||
if (a.length !== b.length) return false;
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (
|
||||
@@ -196,6 +207,7 @@ const LoopMeasurementChart = () => {
|
||||
options,
|
||||
});
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [loopMeasurementCurveChartData, selectedMode, vonDatum, bisDatum]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user