feat: Display und Chart für KÜs
This commit is contained in:
@@ -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}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user