- 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
29 lines
986 B
TypeScript
29 lines
986 B
TypeScript
// /redux/slices/kueChartModeSlice.ts
|
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
|
|
|
interface KueChartModeState {
|
|
activeMode: "Schleife" | "TDR"; // 🔥 Zustand für den aktiven Modus
|
|
selectedSlot: number | null; // 🔥 Neu: Aktuell gewählter Slot
|
|
}
|
|
|
|
const initialState: KueChartModeState = {
|
|
activeMode: "Schleife", // Standard ist Schleife
|
|
selectedSlot: null, // Standard: Kein Slot ausgewählt
|
|
};
|
|
|
|
export const kueChartModeSlice = createSlice({
|
|
name: "kueChartModeSlice",
|
|
initialState,
|
|
reducers: {
|
|
setActiveMode: (state, action: PayloadAction<"Schleife" | "TDR">) => {
|
|
state.activeMode = action.payload; // 🔥 Speichert den Modus (Schleife oder TDR)
|
|
},
|
|
setSelectedSlot: (state, action: PayloadAction<number>) => {
|
|
state.selectedSlot = action.payload; // 🔥 Speichert den aktiven Slot
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setActiveMode, setSelectedSlot } = kueChartModeSlice.actions;
|
|
export default kueChartModeSlice.reducer;
|