"use client"; import { useState, useEffect } from "react"; import ReactModal from "react-modal"; import KueEinstellung from "./KueEinstellung"; import TdrEinstellung from "./TdrEinstellung"; import KvzModalView from "./KvzModalView"; import Knotenpunkte from "./Knotenpunkte"; interface KueModalProps { showModal: boolean; onClose: () => void; slot: number; onModulNameChange: (id: string) => void; } declare global { interface Window { __lastKueTab?: "kue" | "tdr" | "kvz" | "knoten"; kabelModalOpen?: boolean; } } export default function KueModal({ showModal, onClose, slot }: KueModalProps) { const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "kvz" | "knoten">( () => { if (typeof window !== "undefined" && window.__lastKueTab) { return window.__lastKueTab; } return "kue"; } ); useEffect(() => { if (typeof window !== "undefined") { window.__lastKueTab = activeTab; } }, [activeTab]); useEffect(() => { if (typeof window !== "undefined") { window.kabelModalOpen = showModal; } }, [showModal]); return (

Einstellungen KÜ {slot + 1}

{[ { label: "Allgemein", key: "kue" as const }, { label: "TDR", key: "tdr" as const }, { label: "KVz", key: "kvz" as const }, { label: "Knotenpunkte", key: "knoten" as const }, ].map(({ label, key }) => { const isActive = activeTab === key; return ( ); })}
{activeTab === "kue" && ( console.log("Modulname geändert:", id)} onClose={onClose} /> )} {activeTab === "tdr" && ( )} {activeTab === "kvz" && } {activeTab === "knoten" && ( )}
); }