refactor: LoopChartActionBar Dropdowns auf Listbox mit Littwin-Design umgestellt
- selectedMode (DIA0/DIA1/DIA2) ersetzt durch Headless UI Listbox - selectedSlotType (Schleifen-/Isolationswiderstand) ebenfalls als Listbox - Einheitliches Dropdown-Design mit MeldungenView und TDRChartActionBar - Littwin-blue Stil für ausgewählte Optionen integriert
This commit is contained in:
@@ -14,7 +14,6 @@ import Footer from "@/components/footer/Footer";
|
||||
|
||||
// Thunks importieren
|
||||
import { getKueDataThunk } from "@/redux/thunks/getKueDataThunk";
|
||||
import { getDigitalOutputsThunk } from "@/redux/thunks/getDigitalOutputsThunk";
|
||||
import { getAnalogInputsThunk } from "@/redux/thunks/getAnalogInputsThunk";
|
||||
import { getAnalogInputsHistoryThunk } from "@/redux/thunks/getAnalogInputsHistoryThunk";
|
||||
import { getLast20MessagesThunk } from "@/redux/thunks/getLast20MessagesThunk";
|
||||
@@ -57,18 +56,31 @@ function AppContent({
|
||||
const [sessionExpired] = useState(false);
|
||||
const mode = "DIA0"; // oder aus Router oder Session
|
||||
const type = 0; // Beispiel: 0 für "loop", 1 für "iso" (bitte ggf. anpassen)
|
||||
const [pathname, setPathname] = useState(
|
||||
typeof window !== "undefined" ? window.location.pathname : ""
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const handleRouteChange = () => {
|
||||
setPathname(window.location.pathname);
|
||||
};
|
||||
|
||||
window.addEventListener("popstate", handleRouteChange);
|
||||
window.addEventListener("pushstate", handleRouteChange);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("popstate", handleRouteChange);
|
||||
window.removeEventListener("pushstate", handleRouteChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let intervalId: NodeJS.Timeout;
|
||||
const pathname = window.location.pathname;
|
||||
|
||||
const loadAndDispatch = () => {
|
||||
dispatch(getAuthThunks());
|
||||
if (pathname.includes("kabelueberwachung")) {
|
||||
dispatch(getKueDataThunk());
|
||||
} else if (pathname.includes("digitalOutputs")) {
|
||||
dispatch(getDigitalOutputsThunk());
|
||||
} else if (pathname.includes("digitalInputs")) {
|
||||
dispatch(getDigitalOutputsThunk()); // 🟠 evtl. anpassen
|
||||
} else if (pathname.includes("analogInputs")) {
|
||||
dispatch(getAnalogInputsThunk());
|
||||
} else if (pathname.includes("analogHistory")) {
|
||||
@@ -105,7 +117,7 @@ function AppContent({
|
||||
intervalId = setInterval(loadAndDispatch, 10000);
|
||||
return () => clearInterval(intervalId);
|
||||
}
|
||||
}, [dispatch]);
|
||||
}, [pathname, dispatch]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen overflow-hidden">
|
||||
|
||||
@@ -20,12 +20,9 @@ const DigitalOutputs: React.FC = () => {
|
||||
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getDigitalOutputsThunk());
|
||||
|
||||
const interval = setInterval(() => {
|
||||
dispatch(getDigitalInputsThunk());
|
||||
dispatch(getDigitalOutputsThunk());
|
||||
}, 500);
|
||||
}, 3000); // z. B. alle 3 Sekunden statt 0.5s
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [dispatch]);
|
||||
|
||||
Reference in New Issue
Block a user