feat: Fullscreen-Zustand mit Redux verwaltet
- `isFullScreen` zum Redux-Slice hinzugefügt - `ChartSwitcher.tsx` angepasst, um Redux zu nutzen - `LoopMeasurementChart.tsx` & `TDRChart.tsx` auf Redux umgestellt - Fullscreen-Zustand bleibt jetzt persistent
This commit is contained in:
@@ -7,7 +7,10 @@ import LoopMeasurementChart from "./LoopMeasurementChart/LoopMeasurementChart";
|
||||
import TDRChart from "./TDRChart/TDRChart";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { RootState } from "../../../../../redux/store";
|
||||
import { setChartOpen } from "../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
import {
|
||||
setChartOpen,
|
||||
setFullScreen,
|
||||
} from "../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
|
||||
interface ChartSwitcherProps {
|
||||
isOpen: boolean;
|
||||
@@ -19,17 +22,20 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
|
||||
const activeMode = useSelector(
|
||||
(state: RootState) => state.kueChartMode.activeMode
|
||||
);
|
||||
const [isFullScreen, setIsFullScreen] = useState(false);
|
||||
const isFullScreen = useSelector(
|
||||
(state: RootState) => state.kabelueberwachungChart.isFullScreen
|
||||
);
|
||||
|
||||
// **Modal schließen + Redux-Status zurücksetzen**
|
||||
const handleClose = () => {
|
||||
dispatch(setChartOpen(false));
|
||||
dispatch(setFullScreen(false));
|
||||
onClose();
|
||||
};
|
||||
|
||||
// **Vollbildmodus umschalten**
|
||||
const toggleFullScreen = () => {
|
||||
setIsFullScreen(!isFullScreen);
|
||||
dispatch(setFullScreen(!isFullScreen));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -108,7 +114,7 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
|
||||
<>
|
||||
<h3 className="text-lg font-semibold">Schleifenmessung</h3>
|
||||
<LoopChartActionBar />
|
||||
<div style={{ flex: 1, height: "100%" }}>
|
||||
<div style={{ flex: 1, height: "90%" }}>
|
||||
<LoopMeasurementChart isFullScreen={isFullScreen} />
|
||||
</div>
|
||||
</>
|
||||
@@ -116,7 +122,7 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({ isOpen, onClose }) => {
|
||||
<>
|
||||
<h3 className="text-lg font-semibold">TDR-Messung</h3>
|
||||
<TDRChartActionBar />
|
||||
<div style={{ flex: 1, height: "100%" }}>
|
||||
<div style={{ flex: 1, height: "90%" }}>
|
||||
<TDRChart isFullScreen={isFullScreen} />
|
||||
</div>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user