refactor: SystemSettings-Dispatch aus _app entfernt und in Seite 'Einstellungen' verlagert

This commit is contained in:
ISA
2025-03-25 08:35:46 +01:00
parent 6730ba92be
commit 8e6b26dff9
5 changed files with 78 additions and 47 deletions

View File

@@ -1,9 +1,52 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { useAppDispatch } from "../redux/store";
import { setSystemSettings } from "../redux/slices/systemSettingsSlice";
import { loadWindowVariables } from "../utils/loadWindowVariables";
import GeneralSettings from "../components/main/settingsPageComponents/GeneralSettings";
import OPCUAInterfaceSettings from "../components/main/settingsPageComponents/OPCUAInterfaceSettings";
export default function Settings() {
const [activeTab, setActiveTab] = useState("tab1");
const dispatch = useAppDispatch();
useEffect(() => {
const loadSettings = async () => {
const vars = await loadWindowVariables();
if (!vars) return;
const {
deviceName,
mac1,
ip,
subnet,
gateway,
cplInternalTimestamp,
ntp1,
ntp2,
ntp3,
ntpTimezone,
ntpActive,
} = vars;
dispatch(
setSystemSettings({
deviceName,
mac1,
ip,
subnet,
gateway,
cplInternalTimestamp,
ntp1,
ntp2,
ntp3,
ntpTimezone,
ntpActive,
})
);
};
loadSettings();
}, [dispatch]);
return (
<div className="p-4">