Messkurve für Schleife und TDR auf 90% maximieren

This commit is contained in:
ISA
2025-02-25 09:40:15 +01:00
parent 9a9614ffd8
commit 47120c4dea
4 changed files with 82 additions and 55 deletions

View File

@@ -23,8 +23,8 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
// **Modal schließen + Redux-Status zurücksetzen** // **Modal schließen + Redux-Status zurücksetzen**
const handleClose = () => { const handleClose = () => {
dispatch(setChartOpen(false)); // Schalter zurücksetzen dispatch(setChartOpen(false));
onClose(); // Originale Schließen-Funktion aufrufen onClose();
}; };
// **Vollbildmodus umschalten** // **Vollbildmodus umschalten**
@@ -35,7 +35,7 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
return ( return (
<ReactModal <ReactModal
isOpen={isOpen} isOpen={isOpen}
onRequestClose={handleClose} // Hier `handleClose` statt `onClose` onRequestClose={handleClose}
ariaHideApp={false} ariaHideApp={false}
style={{ style={{
overlay: { backgroundColor: "rgba(0, 0, 0, 0.5)" }, overlay: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
@@ -45,63 +45,83 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
bottom: "auto", bottom: "auto",
marginRight: "-50%", marginRight: "-50%",
transform: "translate(-50%, -50%)", transform: "translate(-50%, -50%)",
width: isFullScreen ? "100vw" : "70rem", width: isFullScreen ? "90vw" : "70rem",
height: isFullScreen ? "100vh" : "35rem", height: isFullScreen ? "90vh" : "35rem",
padding: "1rem", padding: "1rem",
transition: "all 0.3s ease-in-out", transition: "all 0.3s ease-in-out",
display: "flex",
flexDirection: "column",
}, },
}} }}
> >
{/* Schließen-Button */} {/* Action-Buttons */}
<button <div
onClick={handleClose}
style={{
position: "absolute",
top: "0.625rem",
right: "3rem",
background: "transparent",
border: "none",
fontSize: "1.5rem",
cursor: "pointer",
}}
>
<i className="bi bi-x-circle-fill"></i>
</button>
{/* Fullscreen-Button */}
<button
onClick={toggleFullScreen}
style={{ style={{
position: "absolute", position: "absolute",
top: "0.625rem", top: "0.625rem",
right: "0.625rem", right: "0.625rem",
background: "transparent", display: "flex",
border: "none", gap: "0.75rem",
fontSize: "1.5rem",
cursor: "pointer",
}} }}
> >
<i {/* Fullscreen-Button */}
className={ <button
isFullScreen ? "bi bi-fullscreen-exit" : "bi bi-arrows-fullscreen" onClick={toggleFullScreen}
} style={{
></i> background: "transparent",
</button> border: "none",
fontSize: "1.5rem",
cursor: "pointer",
}}
>
<i
className={
isFullScreen ? "bi bi-fullscreen-exit" : "bi bi-arrows-fullscreen"
}
></i>
</button>
{/* Nur die richtige ActionBar und das richtige Chart basierend auf dem Modus anzeigen */} {/* Schließen-Button */}
{activeMode === "Schleife" ? ( <button
<> onClick={handleClose}
<h3 className="text-lg font-semibold">Schleifenmessung</h3> style={{
<LoopChartActionBar /> background: "transparent",
<LoopMeasurementChart /> border: "none",
</> fontSize: "1.5rem",
) : ( cursor: "pointer",
<> }}
<h3 className="text-lg font-semibold">TDR-Messung</h3> >
<TDRChartActionBar /> <i className="bi bi-x-circle-fill"></i>
<TDRChart /> </button>
</> </div>
)}
{/* Chart-Container */}
<div
style={{
flex: 1,
display: "flex",
flexDirection: "column",
height: "100%",
}}
>
{activeMode === "Schleife" ? (
<>
<h3 className="text-lg font-semibold">Schleifenmessung</h3>
<LoopChartActionBar />
<div style={{ flex: 1, height: "100%" }}>
<LoopMeasurementChart isFullScreen={isFullScreen} />
</div>
</>
) : (
<>
<h3 className="text-lg font-semibold">TDR-Messung</h3>
<TDRChartActionBar />
<div style={{ flex: 1, height: "100%" }}>
<TDRChart isFullScreen={isFullScreen} />
</div>
</>
)}
</div>
</ReactModal> </ReactModal>
); );
}; };

View File

@@ -1,11 +1,12 @@
"use client"; // components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx "use client"; // components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { RootState } from "../../../../../../redux/store"; import { RootState } from "../../../../../../redux/store";
import Chart from "chart.js/auto"; import Chart from "chart.js/auto";
import "chartjs-adapter-moment"; import "chartjs-adapter-moment";
const LoopMeasurementChart = () => { const LoopMeasurementChart = ({ isFullScreen }: { isFullScreen: boolean }) => {
const chartRef = useRef<HTMLCanvasElement>(null); const chartRef = useRef<HTMLCanvasElement>(null);
const chartInstance = useRef<Chart | null>(null); const chartInstance = useRef<Chart | null>(null);
const [zoomPlugin, setZoomPlugin] = useState<any>(null); const [zoomPlugin, setZoomPlugin] = useState<any>(null);
@@ -170,8 +171,14 @@ const LoopMeasurementChart = () => {
}, [loopMeasurementCurveChartData, vonDatum, bisDatum, selectedMode]); }, [loopMeasurementCurveChartData, vonDatum, bisDatum, selectedMode]);
return ( return (
<div style={{ position: "relative", width: "100%", height: "400px" }}> <div
<canvas ref={chartRef} /> style={{
position: "relative",
width: "100%",
height: isFullScreen ? "90%" : "400px",
}}
>
<canvas ref={chartRef} style={{ width: "100%", height: "100%" }} />
</div> </div>
); );
}; };

View File

@@ -4,7 +4,7 @@ import { useSelector } from "react-redux";
import { Chart, registerables } from "chart.js"; import { Chart, registerables } from "chart.js";
import "chartjs-adapter-date-fns"; import "chartjs-adapter-date-fns";
const TDRChart: React.FC = () => { const TDRChart: React.FC<{ isFullScreen: boolean }> = ({ isFullScreen }) => {
const chartRef = useRef<HTMLCanvasElement>(null); const chartRef = useRef<HTMLCanvasElement>(null);
const chartInstance = useRef<Chart | null>(null); const chartInstance = useRef<Chart | null>(null);
@@ -85,8 +85,8 @@ const TDRChart: React.FC = () => {
}, [tdrChartData]); }, [tdrChartData]);
return ( return (
<div> <div style={{ width: "100%", height: isFullScreen ? "100%" : "20rem" }}>
<canvas ref={chartRef} style={{ width: "100%", height: "20rem" }} /> <canvas ref={chartRef} style={{ width: "100%", height: "100%" }} />
</div> </div>
); );
}; };

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/ */
const webVersion = "1.6.107"; const webVersion = "1.6.108";
export default webVersion; export default webVersion;