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:
@@ -32,6 +32,9 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({
|
||||
slotIndex,
|
||||
}) => {
|
||||
const dispatch = useDispatch<AppDispatch>();
|
||||
const chartTitle = useSelector(
|
||||
(state: RootState) => state.loopChartType.chartTitle
|
||||
);
|
||||
|
||||
// **Redux-States für aktive Messkurve (TDR oder Schleife)**
|
||||
const activeMode = useSelector(
|
||||
@@ -146,7 +149,7 @@ const ChartSwitcher: React.FC<ChartSwitcherProps> = ({
|
||||
>
|
||||
{activeMode === "Schleife" ? (
|
||||
<>
|
||||
<h3 className="text-lg font-semibold">Schleifenmessung</h3>
|
||||
<h3 className="text-lg font-semibold">{chartTitle}</h3>
|
||||
<LoopChartActionBar />
|
||||
<div style={{ flex: 1, height: "90%" }}>
|
||||
<LoopMeasurementChart />
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
setChartOpen,
|
||||
} from "../../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
import { setBrushRange } from "../../../../../../redux/slices/brushSlice";
|
||||
import { setChartTitle } from "../../../../../../redux/slices/loopChartTypeSlice";
|
||||
|
||||
const LoopChartActionBar: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -154,13 +155,19 @@ const LoopChartActionBar: React.FC = () => {
|
||||
|
||||
<select
|
||||
value={selectedSlotType}
|
||||
onChange={(e) =>
|
||||
onChange={(e) => {
|
||||
const value = e.target.value as
|
||||
| "isolationswiderstand"
|
||||
| "schleifenwiderstand";
|
||||
dispatch(setSelectedSlotType(value));
|
||||
dispatch(
|
||||
setSelectedSlotType(
|
||||
e.target.value as "isolationswiderstand" | "schleifenwiderstand"
|
||||
setChartTitle(
|
||||
value === "isolationswiderstand"
|
||||
? "Isolationsmessung"
|
||||
: "Schleifenmessung"
|
||||
)
|
||||
)
|
||||
}
|
||||
);
|
||||
}}
|
||||
className="px-3 py-1 bg-white border rounded text-sm"
|
||||
>
|
||||
<option value="schleifenwiderstand">Schleifenwiderstand</option>
|
||||
|
||||
Reference in New Issue
Block a user