Modal für Messkurve auslagern
This commit is contained in:
66
components/modales/kueModal/ChartModal.tsx
Normal file
66
components/modales/kueModal/ChartModal.tsx
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import React from "react";
|
||||||
|
import ReactModal from "react-modal";
|
||||||
|
import TDRPopup from "./TDRPopup";
|
||||||
|
|
||||||
|
interface ChartModalProps {
|
||||||
|
isOpen: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
chartRef: React.RefObject<HTMLCanvasElement>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ChartModal: React.FC<ChartModalProps> = ({
|
||||||
|
isOpen,
|
||||||
|
onClose,
|
||||||
|
chartRef,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<ReactModal
|
||||||
|
isOpen={isOpen}
|
||||||
|
onRequestClose={onClose}
|
||||||
|
ariaHideApp={false}
|
||||||
|
style={{
|
||||||
|
overlay: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
|
||||||
|
content: {
|
||||||
|
top: "50%",
|
||||||
|
left: "50%",
|
||||||
|
right: "auto",
|
||||||
|
bottom: "auto",
|
||||||
|
marginRight: "-50%",
|
||||||
|
transform: "translate(-50%, -50%)",
|
||||||
|
width: "80%",
|
||||||
|
maxWidth: "50rem",
|
||||||
|
height: "30rem",
|
||||||
|
padding: "1rem",
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
onClick={onClose}
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: "0.625rem",
|
||||||
|
right: "0.625rem",
|
||||||
|
background: "transparent",
|
||||||
|
border: "none",
|
||||||
|
fontSize: "1.5rem",
|
||||||
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<i className="bi bi-x-circle-fill"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div style={{ maxHeight: "100%", overflow: "auto" }}>
|
||||||
|
<TDRPopup />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<canvas
|
||||||
|
id="myChart"
|
||||||
|
ref={chartRef}
|
||||||
|
style={{ width: "100%", height: "20rem" }}
|
||||||
|
></canvas>
|
||||||
|
</ReactModal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ChartModal;
|
||||||
@@ -19,6 +19,8 @@ import { goLoop } from "../../utils/goLoop";
|
|||||||
import { goTDR } from "../../utils/goTDR";
|
import { goTDR } from "../../utils/goTDR";
|
||||||
import { loadTDRChartData } from "../../utils/loadTDRChartData";
|
import { loadTDRChartData } from "../../utils/loadTDRChartData";
|
||||||
import { loadLoopChartData } from "../../utils/loadLoopChartData";
|
import { loadLoopChartData } from "../../utils/loadLoopChartData";
|
||||||
|
import { Kue705FOProps } from "../../types/components/Kue705FOProps";
|
||||||
|
import ChartModal from "../modales/kueModal/ChartModal";
|
||||||
|
|
||||||
const Kue705FO: React.FC<Kue705FOProps> = ({
|
const Kue705FO: React.FC<Kue705FOProps> = ({
|
||||||
isolationswert,
|
isolationswert,
|
||||||
@@ -187,7 +189,7 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
kueGroundFault,
|
kueGroundFault,
|
||||||
kueAlarm1,
|
kueAlarm1,
|
||||||
kueAlarm2,
|
kueAlarm2,
|
||||||
kueOverflow,
|
kueOverflow ?? undefined,
|
||||||
isolationswert,
|
isolationswert,
|
||||||
isoDisplayText,
|
isoDisplayText,
|
||||||
groundFaultDisplayText,
|
groundFaultDisplayText,
|
||||||
@@ -425,60 +427,11 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
|
|
||||||
{/* Modal für Messkurve */}
|
{/* Modal für Messkurve */}
|
||||||
{showChartModal && (
|
{showChartModal && (
|
||||||
<ReactModal
|
<ChartModal
|
||||||
isOpen={showChartModal}
|
isOpen={showChartModal}
|
||||||
onRequestClose={handleCloseChartModal}
|
onClose={handleCloseChartModal}
|
||||||
ariaHideApp={false}
|
chartRef={chartRef}
|
||||||
style={{
|
/>
|
||||||
overlay: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
|
|
||||||
content: {
|
|
||||||
top: "50%",
|
|
||||||
left: "50%",
|
|
||||||
right: "auto",
|
|
||||||
bottom: "auto",
|
|
||||||
marginRight: "-50%",
|
|
||||||
transform: "translate(-50%, -50%)",
|
|
||||||
width: "80%", // Breite reduzieren
|
|
||||||
maxWidth: "50rem", // Maximale Breite
|
|
||||||
height: "30rem", // Höhe anpassen
|
|
||||||
padding: "1rem", // Weniger Padding
|
|
||||||
overflow: "hidden", // Scrollen vermeiden
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
onClick={handleCloseChartModal}
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
top: "0.625rem",
|
|
||||||
right: "0.625rem",
|
|
||||||
background: "transparent",
|
|
||||||
border: "none",
|
|
||||||
fontSize: "1.5rem",
|
|
||||||
cursor: "pointer",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<i className="bi bi-x-circle-fill"></i>{" "}
|
|
||||||
{/* Bootstrap Icon "X" */}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{/* Verwenden Sie die separate TDRPopup-Komponente */}
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
maxHeight: "100%", // Inhalte anpassen
|
|
||||||
overflow: "auto", // Nur bei Bedarf Scrollen aktivieren
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TDRPopup />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Canvas für die Chart.js-Grafik */}
|
|
||||||
<canvas
|
|
||||||
id="myChart"
|
|
||||||
ref={chartRef}
|
|
||||||
style={{ width: "100%", height: "20rem" }} // Grafikhöhe reduzieren
|
|
||||||
></canvas>
|
|
||||||
</ReactModal>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -491,13 +444,3 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default Kue705FO;
|
export default Kue705FO;
|
||||||
|
|
||||||
interface Kue705FOProps {
|
|
||||||
isolationswert: number | string | JSX.Element;
|
|
||||||
schleifenwiderstand: number | string;
|
|
||||||
modulName: string;
|
|
||||||
kueOnline: number;
|
|
||||||
slotIndex: number;
|
|
||||||
tdrLocation: number[];
|
|
||||||
alarmStatus?: boolean;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export interface VariablesState {
|
|||||||
kueOnline: string[] | number[];
|
kueOnline: string[] | number[];
|
||||||
kueID: string[];
|
kueID: string[];
|
||||||
kueIso: string[];
|
kueIso: string[];
|
||||||
kuePSTmMinus96V: string[];
|
kuePSTmMinus96V: number[];
|
||||||
kueAlarm1: number[];
|
kueAlarm1: number[];
|
||||||
kueAlarm2: number[];
|
kueAlarm2: number[];
|
||||||
kueResidence: string[];
|
kueResidence: string[];
|
||||||
@@ -50,7 +50,7 @@ export interface VariablesState {
|
|||||||
tdrTrigger: number | null;
|
tdrTrigger: number | null;
|
||||||
tdrLocation: number | null;
|
tdrLocation: number | null;
|
||||||
tdrActive: boolean | null;
|
tdrActive: boolean | null;
|
||||||
kueOverflow: string | null;
|
kueOverflow: number[] | null;
|
||||||
tdrLast: string | null;
|
tdrLast: string | null;
|
||||||
appVersion: string | null;
|
appVersion: string | null;
|
||||||
win_analogeEingaenge1: string | null;
|
win_analogeEingaenge1: string | null;
|
||||||
|
|||||||
10
types/components/Kue705FOProps.ts
Normal file
10
types/components/Kue705FOProps.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// types/components/Kue705FOProps.ts
|
||||||
|
export interface Kue705FOProps {
|
||||||
|
isolationswert: number | string;
|
||||||
|
schleifenwiderstand: number | string;
|
||||||
|
modulName: string;
|
||||||
|
kueOnline: number;
|
||||||
|
slotIndex: number;
|
||||||
|
tdrLocation: number[];
|
||||||
|
alarmStatus?: boolean;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user