fix: Kabelüberwachung: Modal springt hin und her
This commit is contained in:
@@ -50,7 +50,10 @@ export default function Knotenpunkte({ slot }: Props) {
|
|||||||
}, [slot]);
|
}, [slot]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4 text-sm laptop:text-base">
|
<div
|
||||||
|
className="space-y-2 text-sm laptop:text-base"
|
||||||
|
style={{ maxHeight: "calc(75vh - 4rem)", overflowY: "auto" }}
|
||||||
|
>
|
||||||
{/*
|
{/*
|
||||||
<h2 className="text-base laptop:text-lg font-semibold">
|
<h2 className="text-base laptop:text-lg font-semibold">
|
||||||
Knotenpunkte & Verbindungen – Slot {slot + 1}
|
Knotenpunkte & Verbindungen – Slot {slot + 1}
|
||||||
|
|||||||
@@ -133,7 +133,10 @@ export default function KueEinstellung({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="text-black space-y-6">
|
<div
|
||||||
|
className="overflow-y-auto"
|
||||||
|
style={{ maxHeight: "55vh" }} // oder z. B. 600px
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<label className="font-bold">Kabelbezeichnung:</label>
|
<label className="font-bold">Kabelbezeichnung:</label>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ interface KueModalProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
||||||
// 🧠 Tab wird initial nur einmal aus globalem Speicher geladen
|
|
||||||
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">(() => {
|
const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">(() => {
|
||||||
if (typeof window !== "undefined" && (window as any).__lastKueTab) {
|
if (typeof window !== "undefined" && (window as any).__lastKueTab) {
|
||||||
return (window as any).__lastKueTab;
|
return (window as any).__lastKueTab;
|
||||||
@@ -21,12 +20,12 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
|||||||
return "kue";
|
return "kue";
|
||||||
});
|
});
|
||||||
|
|
||||||
// 🔁 Bei jeder Tab-Änderung speichern wir ihn global
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
(window as any).__lastKueTab = activeTab;
|
(window as any).__lastKueTab = activeTab;
|
||||||
}
|
}
|
||||||
}, [activeTab]);
|
}, [activeTab]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
window.kabelModalOpen = showModal;
|
window.kabelModalOpen = showModal;
|
||||||
@@ -46,8 +45,6 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
|||||||
content: {
|
content: {
|
||||||
top: "50%",
|
top: "50%",
|
||||||
left: "50%",
|
left: "50%",
|
||||||
right: "auto",
|
|
||||||
bottom: "auto",
|
|
||||||
transform: "translate(-50%, -50%)",
|
transform: "translate(-50%, -50%)",
|
||||||
width: "90%",
|
width: "90%",
|
||||||
maxWidth: "850px",
|
maxWidth: "850px",
|
||||||
@@ -55,6 +52,8 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
|||||||
border: "none",
|
border: "none",
|
||||||
borderRadius: "8px",
|
borderRadius: "8px",
|
||||||
position: "relative",
|
position: "relative",
|
||||||
|
bottom: "auto",
|
||||||
|
right: "auto",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -66,48 +65,34 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center bg-gray-100 space-x-2 p-2">
|
<div className="flex justify-center bg-gray-100 space-x-2 p-2">
|
||||||
<button
|
{[
|
||||||
onClick={() => setActiveTab("kue")}
|
{ label: "KUE Einstellung", key: "kue" },
|
||||||
className={`px-4 py-1 rounded-t font-bold text-base ${
|
{ label: "TDR Einstellung", key: "tdr" },
|
||||||
activeTab === "kue"
|
{ label: "Knotenpunkte", key: "knoten" },
|
||||||
? "bg-white text-blue-600"
|
].map(({ label, key }) => (
|
||||||
: "text-gray-500 hover:text-black"
|
<button
|
||||||
}`}
|
key={key}
|
||||||
>
|
onClick={() => setActiveTab(key as any)}
|
||||||
KUE Einstellung
|
className={`px-4 py-1 rounded-t font-bold text-sm ${
|
||||||
</button>
|
activeTab === key
|
||||||
<button
|
? "bg-white text-blue-600"
|
||||||
onClick={() => setActiveTab("tdr")}
|
: "text-gray-500 hover:text-black"
|
||||||
className={`px-4 py-1 rounded-t font-bold text-sm ${
|
}`}
|
||||||
activeTab === "tdr"
|
>
|
||||||
? "bg-white text-blue-600"
|
{label}
|
||||||
: "text-gray-500 hover:text-black"
|
</button>
|
||||||
}`}
|
))}
|
||||||
>
|
|
||||||
TDR Einstellung
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("knoten")}
|
|
||||||
className={`px-4 py-1 rounded-t font-bold text-sm ${
|
|
||||||
activeTab === "knoten"
|
|
||||||
? "bg-white text-blue-600"
|
|
||||||
: "text-gray-500 hover:text-black"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
Knotenpunkte
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="p-4 bg-white rounded-b-md max-h-[75vh] overflow-y-auto">
|
<div className="p-4 bg-white rounded-b-md h-[20rem] laptop:h-[24rem] 2xl:h-[30rem] overflow-y-auto">
|
||||||
<div style={{ display: activeTab === "kue" ? "block" : "none" }}>
|
{activeTab === "kue" && (
|
||||||
<KueEinstellung
|
<KueEinstellung
|
||||||
slot={slot}
|
slot={slot}
|
||||||
showModal={showModal} // ← hier übergeben
|
showModal={showModal}
|
||||||
onModulNameChange={(id) => console.log("Modulname geändert:", id)}
|
onModulNameChange={(id) => console.log("Modulname geändert:", id)}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
</div>
|
)}
|
||||||
|
|
||||||
{activeTab === "tdr" && (
|
{activeTab === "tdr" && (
|
||||||
<TdrEinstellung slot={slot} onClose={onClose} />
|
<TdrEinstellung slot={slot} onClose={onClose} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ export default function TdrEinstellung({ slot, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pt-4 flex justify-end">
|
<div className="qhd:pt-48 2xl:pt-16 xl:pt-8 laptop:pt-2 flex justify-end">
|
||||||
<button
|
<button
|
||||||
onClick={handleSave}
|
onClick={handleSave}
|
||||||
className="bg-littwin-blue text-white px-4 py-2 rounded shadow hover:bg-blue-700"
|
className="bg-littwin-blue text-white px-4 py-2 rounded shadow hover:bg-blue-700"
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.355";
|
const webVersion = "1.6.356";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user