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 (