Merge branch 'v1.0.8.1' into fix/ohne-externe-babel
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
// /redux/actions.js
|
||||
export const connectWebSocket = (url) => ({
|
||||
type: "WS_CONNECT",
|
||||
payload: { url },
|
||||
});
|
||||
|
||||
export const disconnectWebSocket = () => ({
|
||||
type: "WS_DISCONNECT",
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
// redux/reducer.js
|
||||
import { combineReducers } from "redux";
|
||||
import currentPoiReducer from "./slices/currentPoiSlice";
|
||||
import gisStationsStaticDistrictReducer from "./slices/gisStationsStaticDistrictSlice";
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
currentPoi: currentPoiReducer,
|
||||
gisStationsStaticDistrict: gisStationsStaticDistrictReducer,
|
||||
});
|
||||
|
||||
export default rootReducer;
|
||||
23
redux/slices/lineVisibilitySlice.js
Normal file
23
redux/slices/lineVisibilitySlice.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// /rdux/slices/lineVisibilitySlice.js
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
const initialState = {
|
||||
activeLines: {}, // Speichert `idLD -> Active`
|
||||
};
|
||||
|
||||
const lineVisibilitySlice = createSlice({
|
||||
name: "lineVisibility",
|
||||
initialState,
|
||||
reducers: {
|
||||
updateLineStatus(state, action) {
|
||||
const { idLD, active } = action.payload;
|
||||
state.activeLines[idLD] = active; // Speichert `idLD` in Redux
|
||||
},
|
||||
setActiveLines(state, action) {
|
||||
state.activeLines = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateLineStatus, setActiveLines } = lineVisibilitySlice.actions;
|
||||
export default lineVisibilitySlice.reducer;
|
||||
@@ -1,7 +1,15 @@
|
||||
// redux/slices/poiReadFromDbTriggerSlice.js
|
||||
import { atom } from 'recoil';
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const poiReadFromDbTriggerAtom = atom({
|
||||
key: 'poiReadFromDbTriggerAtom',
|
||||
default: 0, // Sie können auch einen booleschen Wert verwenden
|
||||
});
|
||||
const atomKey = "poiReadFromDbTriggerAtom";
|
||||
|
||||
export const poiReadFromDbTriggerAtom =
|
||||
globalThis.poiReadFromDbTriggerAtom ||
|
||||
atom({
|
||||
key: atomKey,
|
||||
default: 0,
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalThis.poiReadFromDbTriggerAtom = poiReadFromDbTriggerAtom;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
//redux/slices/readPoiMarkersStoreSlice.js
|
||||
import { atom } from 'recoil';
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const readPoiMarkersStore = atom({
|
||||
key: 'readPoiMarkersStore',
|
||||
default: [],
|
||||
});
|
||||
const storeKey = "readPoiMarkersStore";
|
||||
|
||||
// Verhindert doppelte Registrierung bei HMR
|
||||
export const readPoiMarkersStore =
|
||||
globalThis.readPoiMarkersStore ||
|
||||
atom({
|
||||
key: storeKey,
|
||||
default: [],
|
||||
});
|
||||
|
||||
// Speichert das Atom im globalen Namespace (nur in Dev)
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
globalThis.readPoiMarkersStore = readPoiMarkersStore;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import websocketMiddleware from "./middleware/websocketMiddleware";
|
||||
import rootReducer from "./reducer";
|
||||
import lineVisibilityReducer from "./slices/lineVisibilitySlice";
|
||||
import currentPoiReducer from "./slices/currentPoiSlice";
|
||||
import gisStationsStaticDistrictReducer from "./slices/gisStationsStaticDistrictSlice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: rootReducer, // Kombinierter Root-Reducer
|
||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(websocketMiddleware),
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
lineVisibility: lineVisibilityReducer,
|
||||
currentPoi: currentPoiReducer,
|
||||
gisStationsStaticDistrict: gisStationsStaticDistrictReducer,
|
||||
},
|
||||
});
|
||||
|
||||
export default store;
|
||||
|
||||
Reference in New Issue
Block a user