feat: Charttitel in ChartSwitcher dynamisch an Slot-Typ angepasst via loopChartTypeSlice
- Neues Redux Slice erstellt zur Verwaltung des Titels - Dropdown-Auswahl in LoopChartActionBar aktualisiert Redux-Wert - ChartSwitcher verwendet dynamischen Titel statt statischem Text
This commit is contained in:
23
redux/slices/loopChartTypeSlice.ts
Normal file
23
redux/slices/loopChartTypeSlice.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// redux/slices/loopChartTypeSlice.ts
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
interface LoopChartTypeState {
|
||||
chartTitle: string;
|
||||
}
|
||||
|
||||
const initialState: LoopChartTypeState = {
|
||||
chartTitle: "Schleifenmessung", // Standardwert
|
||||
};
|
||||
|
||||
const loopChartTypeSlice = createSlice({
|
||||
name: "loopChartType",
|
||||
initialState,
|
||||
reducers: {
|
||||
setChartTitle: (state, action: PayloadAction<string>) => {
|
||||
state.chartTitle = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setChartTitle } = loopChartTypeSlice.actions;
|
||||
export default loopChartTypeSlice.reducer;
|
||||
Reference in New Issue
Block a user