Modulname von Modal ändern und den Modul übergeben

This commit is contained in:
ISA
2024-10-17 13:51:57 +02:00
parent c5cf6964a2
commit d16c294ca3
2 changed files with 45 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ function Kue705FO({
slotIndex, // Der Index des Slots, für den die Anzeige gilt
tdrLocation, // Wert für die TDR-Entfernung
}) {
const [currentModulName, setCurrentModulName] = useState(modulName);
const [activeButton, setActiveButton] = useState("Schleife");
const [displayText, setDisplayText] = useState("Schleifenwiderstand [kOhm]");
const [loading, setLoading] = useState(false);
@@ -113,6 +114,10 @@ function Kue705FO({
}
};
const handleModulNameChange = (newName) => {
setCurrentModulName(newName); // Aktualisiere den Namen direkt in Kue705FO
};
return (
<div className="relative bg-gray-300 w-[116px] h-[390px] border border-gray-400 scale-110 top-3">
{isModulPresent ? (
@@ -137,6 +142,7 @@ function Kue705FO({
showModal={showModal}
onClose={handleCloseModal}
slot={slotIndex}
onModulNameChange={handleModulNameChange}
>
<h2>Modul Einstellungen</h2>
<p>Hier kannst du Einstellungen für {modulName} vornehmen.</p>
@@ -163,8 +169,17 @@ function Kue705FO({
<div className="absolute top-0 left-[75px] w-[3px] h-full bg-white z-0"></div>
<div className="absolute top-[40px] left-[75px] w-[40px] h-[3px] bg-white z-0"></div>
{/* Modal zum Ändern des Modulnamens */}
<KueModal
showModal={showModal}
onClose={handleCloseModal}
slot={slotIndex}
onModulNameChange={handleModulNameChange}
/>
{/* Modulname */}
<div className="absolute bottom-[20px] left-[10px] text-black text-[10px] bg-gray-300 p-1 w-[100px] text-center">
{modulName || "Test1"}
{currentModulName || "Test1"}
</div>
<div className="absolute bottom-1 right-1 text-black text-[8px]">