diff --git a/components/main/uebersicht/VersionInfo.tsx b/components/main/uebersicht/VersionInfo.tsx index 2220212..dda40db 100644 --- a/components/main/uebersicht/VersionInfo.tsx +++ b/components/main/uebersicht/VersionInfo.tsx @@ -8,7 +8,9 @@ const VersionInfo: React.FC = () => { const appVersion = useSelector((state: RootState) => state.variables.appVersion) || "Unbekannt"; - const webVersion = useSelector(() => "1.0.0"); // Falls `webVersion` aus einer Config kommt + const webVersion = useSelector( + (state: RootState) => state.webVersion.version + ); // Webversion aus Redux holen return (
diff --git a/config/webVersion.ts b/config/webVersion.ts index 96bb60e..0ae1efd 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -5,5 +5,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.26"; +const webVersion = "1.6.27"; export default webVersion; diff --git a/redux/slices/webVersionSlice.ts b/redux/slices/webVersionSlice.ts new file mode 100644 index 0000000..d346898 --- /dev/null +++ b/redux/slices/webVersionSlice.ts @@ -0,0 +1,24 @@ +// redux/slices/webVersionSlice.ts +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; +import webVersion from "../../config/webVersion"; // Importiere die aktuelle Webversion + +interface WebVersionState { + version: string; +} + +const initialState: WebVersionState = { + version: webVersion, // Initiale Version aus `webVersion.ts` +}; + +const webVersionSlice = createSlice({ + name: "webVersion", + initialState, + reducers: { + setWebVersion(state, action: PayloadAction) { + state.version = action.payload; + }, + }, +}); + +export const { setWebVersion } = webVersionSlice.actions; +export default webVersionSlice.reducer; diff --git a/redux/store.ts b/redux/store.ts index d8dae75..a13dae2 100644 --- a/redux/store.ts +++ b/redux/store.ts @@ -3,12 +3,14 @@ import { configureStore } from "@reduxjs/toolkit"; import authReducer from "./slices/authSlice"; import variablesReducer from "./slices/variablesSlice"; import chartDataReducer from "./slices/chartDataSlice"; +import webVersionReducer from "./slices/webVersionSlice"; const store = configureStore({ reducer: { auth: authReducer, variables: variablesReducer, chartData: chartDataReducer, + webVersion: webVersionReducer, }, });