feat: Display und Chart für KÜs

This commit is contained in:
ISA
2025-07-31 09:37:34 +02:00
parent e76c8d9bd2
commit ad6642b5e7
9 changed files with 47 additions and 31 deletions

View File

@@ -12,8 +12,9 @@ declare global {
}
import React, { useState } from "react";
import { useSelector } from "react-redux";
import { useSelector, useDispatch } from "react-redux";
import { RootState } from "../../../../../redux/store";
import { setKueData } from "../../../../../redux/slices/kueDataSlice";
import { useAdminAuth } from "../../../settingsPageComponents/hooks/useAdminAuth";
@@ -24,6 +25,7 @@ interface Props {
export default function TdrEinstellung({ slot, onClose }: Props) {
const { isAdminLoggedIn } = useAdminAuth(true);
const dispatch = useDispatch();
const tdrSlice = useSelector((state: RootState) => state.kueDataSlice);
const cacheKey = `slot_${slot}`;
@@ -126,6 +128,11 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
setTdrActive(newState);
updateCache(tdrData, newState);
// Redux State sofort aktualisieren für UI-Update
const updatedTdrActive = [...(tdrSlice.tdrActive || [])];
updatedTdrActive[slot] = newState ? 1 : 0;
dispatch(setKueData({ tdrActive: updatedTdrActive }));
const isDev = window.location.hostname === "localhost";
const slotParam = `KTX${slot}=${newState ? 1 : 0}`;