feat: ISO, RSL und TDR separate Charts ohne den Switcher

This commit is contained in:
ISA
2025-07-28 13:39:46 +02:00
parent 7a9fbc97dd
commit ce1dacda9b
15 changed files with 612 additions and 263 deletions

View File

@@ -0,0 +1,48 @@
// /redux/slices/loopChartSlice.ts
import { createSlice } from "@reduxjs/toolkit";
import { getLoopChartDataThunk } from "../thunks/getLoopChartDataThunk";
interface ChartData {
[mode: string]: {
[type: number]: any;
};
}
interface LoopChartState {
data: ChartData;
loading: boolean;
error: string | null;
}
const initialState: LoopChartState = {
data: {},
loading: false,
error: null,
};
const isoChartSlice = createSlice({
name: "loopChartSlice",
initialState,
reducers: {},
extraReducers: (builder) => {
builder
.addCase(getLoopChartDataThunk.pending, (state) => {
state.loading = true;
state.error = null;
})
.addCase(getLoopChartDataThunk.fulfilled, (state, action) => {
state.loading = false;
const { mode, type } = action.meta.arg;
if (!state.data[mode]) {
state.data[mode] = {};
}
state.data[mode][type] = action.payload;
})
.addCase(getLoopChartDataThunk.rejected, (state, action) => {
state.loading = false;
state.error = action.payload as string;
});
},
});
export default isoChartSlice.reducer;