fix: aktiver Tab im KueModal bleibt erhalten, kein Zurückspringen auf "kue" mehr
- Tab-Zustand wird in window.__lastKueTab gespeichert - Verhindert automatische Rücksetzung bei Re-Render oder showModal-Änderung - Nutzer bleibt auf dem zuletzt aktiven Tab (TDR, Knotenpunkte etc.)
This commit is contained in:
@@ -9,17 +9,24 @@ interface KueModalProps {
|
|||||||
showModal: boolean;
|
showModal: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
slot: number;
|
slot: number;
|
||||||
onModulNameChange: (id: string) => void; // NEU!
|
onModulNameChange: (id: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
||||||
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">("kue");
|
// 🧠 Tab wird initial nur einmal aus globalem Speicher geladen
|
||||||
|
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">(() => {
|
||||||
useEffect(() => {
|
if (typeof window !== "undefined" && (window as any).__lastKueTab) {
|
||||||
if (showModal) {
|
return (window as any).__lastKueTab;
|
||||||
setActiveTab("kue");
|
|
||||||
}
|
}
|
||||||
}, [showModal]);
|
return "kue";
|
||||||
|
});
|
||||||
|
|
||||||
|
// 🔁 Bei jeder Tab-Änderung speichern wir ihn global
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
(window as any).__lastKueTab = activeTab;
|
||||||
|
}
|
||||||
|
}, [activeTab]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactModal
|
<ReactModal
|
||||||
@@ -96,7 +103,6 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
|||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{activeTab === "tdr" && <TdrEinstellung slot={slot} />}
|
{activeTab === "tdr" && <TdrEinstellung slot={slot} />}
|
||||||
{activeTab === "knoten" && <Knotenpunkte slot={slot} />}
|
{activeTab === "knoten" && <Knotenpunkte slot={slot} />}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.253";
|
const webVersion = "1.6.254";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
BIN
public/images/OPCUA.jpg
Normal file
BIN
public/images/OPCUA.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
Reference in New Issue
Block a user