feat(redux): Rename all Redux slices and store keys to match file names for clarity

- Renamed all slice names (createSlice `name` attribute) to match their file names (e.g. loopChartSlice, authSlice, kueDataSlice etc.)
- Updated `store.ts` to register each reducer with consistent key names (e.g. state.loopChartSlice instead of state.loopChart)
- Adjusted all `useSelector` and Redux state accesses across the codebase
- Improves maintainability, searchability and consistency across files and Redux DevTools
This commit is contained in:
ISA
2025-04-01 12:26:41 +02:00
parent 948bc0d5ea
commit 20e20dec30
41 changed files with 288 additions and 319 deletions

View File

@@ -18,7 +18,7 @@ const Baugruppentraeger: React.FC = () => {
kueAlarm1,
kueAlarm2,
kueGroundFault,
} = useSelector((state: RootState) => state.kueData);
} = useSelector((state: RootState) => state.kueDataSlice);
// `kueOnline` sicherstellen, dass es nur Zahlen enthält
const kueOnline = useMemo(

View File

@@ -9,7 +9,7 @@ const Last20MessagesTable: React.FC = () => {
// Holt last20Messages aus Redux
const rawLast20Messages = useSelector(
(state: RootState) => state.last20Messages.last20Messages
(state: RootState) => state.last20MessagesSlice.last20Messages
);
// Holt Daten aus `window.win_last20Messages` und speichert sie in Redux

View File

@@ -15,19 +15,21 @@ const NetworkInfo: React.FC = () => {
}, [dispatch]);
// Werte direkt aus Redux holen
const ip =
useSelector((state: RootState) => state.systemSettings.ip) || "Unbekannt";
useSelector((state: RootState) => state.systemSettingsSlice.ip) ||
"Unbekannt";
const subnet =
useSelector((state: RootState) => state.systemSettings.subnet) ||
useSelector((state: RootState) => state.systemSettingsSlice.subnet) ||
"Unbekannt";
const gateway =
useSelector((state: RootState) => state.systemSettings.gateway) ||
useSelector((state: RootState) => state.systemSettingsSlice.gateway) ||
"Unbekannt";
const opcUaZustandRaw = useSelector(
(state: RootState) => state.opcuaSettings.opcUaZustand
(state: RootState) => state.opcuaSettingsSlice.opcUaZustand
);
const opcUaNodesetName =
useSelector((state: RootState) => state.opcuaSettings.opcUaNodesetName) ||
"Unbekannt";
useSelector(
(state: RootState) => state.opcuaSettingsSlice.opcUaNodesetName
) || "Unbekannt";
// OPC-UA Zustand in lesbaren Text umwandeln
const opcUaZustand =
Number(opcUaZustandRaw) === 1

View File

@@ -6,10 +6,10 @@ import { RootState } from "../../../redux/store";
const VersionInfo: React.FC = () => {
const appVersion =
useSelector((state: RootState) => state.systemSettings.appVersion) ||
useSelector((state: RootState) => state.systemSettingsSlice.appVersion) ||
"Unbekannt";
const webVersion = useSelector(
(state: RootState) => state.webVersion.version
(state: RootState) => state.webVersionSlice.version
); // Webversion aus Redux holen
return (