// components/main/system/DetailModal.tsx "use client"; import React from "react"; import { Line } from "react-chartjs-2"; import { useSelector } from "react-redux"; import { RootState } from "@/redux/store"; type Props = { isOpen: boolean; selectedKey: string | null; onClose: () => void; }; export const DetailModal = ({ isOpen, selectedKey, onClose }: Props) => { // Mapping: Welcher Redux-Zweig zu welchem selectedKey gehört const typMap: Record = { "+5V": "DIA1", "+15V": "DIA1", "-15V": "DIA1", "-98V": "DIA1", }; const typ = selectedKey ? typMap[selectedKey] : null; // Redux State abrufen const reduxData = useSelector((state: RootState) => typ ? state.systemspannung5Vplus[typ] : [] ); // Zeitstempel und Werte extrahieren type DataPoint = { t: string; i: number }; const labels = reduxData.map((e: unknown) => (e as DataPoint).t); const values = reduxData.map((e: unknown) => (e as DataPoint).i); const baseOptions = { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: false, grid: { color: "rgba(200,200,200,0.2)" }, title: { display: true, text: "Wert" }, }, x: { grid: { color: "rgba(200,200,200,0.2)" }, title: { display: true, text: "Zeit" }, }, }, plugins: { legend: { position: "bottom" as const }, title: { display: true, text: `Verlauf – ${selectedKey}` }, }, }; if (!isOpen || !selectedKey) return null; return (

Detailansicht: {selectedKey}

); };