// 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; zeitraum: "DIA0" | "DIA1" | "DIA2"; setZeitraum: (typ: "DIA0" | "DIA1" | "DIA2") => void; }; export const DetailModal = ({ isOpen, selectedKey, onClose, zeitraum, setZeitraum, }: Props) => { const typMap: Record = { "+5V": zeitraum, "+15V": zeitraum, "-15V": zeitraum, "-98V": zeitraum, }; const typ = selectedKey ? typMap[selectedKey] : null; type ReduxDataItem = { t: string; i: number }; const reduxData = useSelector((state: RootState) => typ ? (state.systemspannung5Vplus[typ] as ReduxDataItem[]) : [] ); const labels = reduxData.map((e: ReduxDataItem) => e.t); const values = reduxData.map((e: ReduxDataItem) => e.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}

); };