From 22464701226069cb6ee2ffe934d702af9fb4d027 Mon Sep 17 00:00:00 2001 From: ISA Date: Thu, 23 Jan 2025 11:19:57 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Entfernen=20von=20unn=C3=B6tigem=20Scrol?= =?UTF-8?q?len=20und=20Leerbereich=20nach=20dem=20Footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Layout angepasst, um Scrollbalken und Leerbereich nach dem Footer zu vermeiden. - `h-screen` und `overflow-hidden` für die Hauptcontainer verwendet. - Sicherstellung, dass die Seite genau die Bildschirmhöhe ausfüllt. - Cleanup in CSS und JSX zur Verbesserung der Benutzeroberfläche. --- pages/_app.js | 2 +- pages/einausgaenge copy.js | 280 ------------------------------------- 2 files changed, 1 insertion(+), 281 deletions(-) delete mode 100644 pages/einausgaenge copy.js diff --git a/pages/_app.js b/pages/_app.js index b54ca34..74e1e1d 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -38,7 +38,7 @@ function MyApp({ Component, pageProps }) { return ( -
+
diff --git a/pages/einausgaenge copy.js b/pages/einausgaenge copy.js deleted file mode 100644 index fd657be..0000000 --- a/pages/einausgaenge copy.js +++ /dev/null @@ -1,280 +0,0 @@ -"use client"; // pages/einausgaenge.js -import React, { useState, useEffect } from "react"; -import { Icon } from "@iconify/react"; - -function EinAusgaenge() { - const [mockData, setMockData] = useState({ - win_de: Array(32).fill(0), // Fallback-Daten für die Initialisierung - win_counter: Array(32).fill(0), - win_flutter: Array(32).fill(0), - }); - const [isLoading, setIsLoading] = useState(true); - - useEffect(() => { - const isDevelopment = process.env.NODE_ENV === "development"; - const script = document.createElement("script"); - - script.src = isDevelopment - ? "/CPLmockData/SERVICE/de.js" - : "/CPL/SERVICE/de.js"; - script.async = true; - - script.onload = () => { - try { - // Sicherstellen, dass die globalen Variablen verfügbar sind - if ( - typeof win_de !== "undefined" && - typeof win_counter !== "undefined" && - typeof win_flutter !== "undefined" - ) { - setMockData({ - win_de, - win_counter, - win_flutter, - }); - } else { - console.error("Mock-Daten konnten nicht geladen werden."); - } - } catch (error) { - console.error("Fehler beim Zugriff auf die globalen Daten:", error); - } finally { - setIsLoading(false); - } - }; - - script.onerror = () => { - console.error("Fehler beim Laden der Skript-Datei:", script.src); - setIsLoading(false); - }; - - document.body.appendChild(script); - - return () => { - document.body.removeChild(script); - }; - }, []); - - // Hook-Anzahl konstant halten - const digitalInputs = mockData.win_de.map((status, index) => ({ - id: index + 1, - status: status === 1 ? "active" : "inactive", - description: `DE${index + 1}`, - isInverted: false, - })); - - const inputsGroup1 = digitalInputs.slice(0, 16); - const inputsGroup2 = digitalInputs.slice(16); - - const [digitalOutputs, setDigitalOutputs] = useState([ - { id: 1, description: "Ausgang1", toggle: true }, - { id: 2, description: "Ausgang2", toggle: false }, - { id: 3, description: "Ausgang3", toggle: true }, - { id: 4, description: "Ausgang4", toggle: false }, - ]); - - const toggleSwitch = (id) => { - setDigitalOutputs((prevOutputs) => - prevOutputs.map((output) => - output.id === id ? { ...output, toggle: !output.toggle } : output - ) - ); - }; - - const [selectedInput, setSelectedInput] = useState(null); - const [selectedOutput, setSelectedOutput] = useState(null); - const [isInputModalOpen, setIsInputModalOpen] = useState(false); - const [isOutputModalOpen, setIsOutputModalOpen] = useState(false); - - const openInputModal = (input) => { - setSelectedInput(input); - setIsInputModalOpen(true); - }; - - const closeInputModal = () => { - setSelectedInput(null); - setIsInputModalOpen(false); - }; - - const openOutputModal = (output) => { - setSelectedOutput(output); - setIsOutputModalOpen(true); - }; - - const closeOutputModal = () => { - setSelectedOutput(null); - setIsOutputModalOpen(false); - }; - - // Warten auf Daten - if (isLoading) { - return
Daten werden geladen...
; - } - - //-------------------------------------------- - return ( -
-

Ein- und Ausgänge

-
- {/* Digitale Eingänge */} -
-

- - Digitale Eingänge -

-
- {[inputsGroup1, inputsGroup2].map((group, index) => ( -
- - - - - - - - - - - {group.map((input) => ( - - - - - - - ))} - -
EingangZustandBezeichnungAktion
- - {input.id} - - - {input.status === "active" ? "●" : "⨉"} - - {input.description} - openInputModal(input)} - /> -
-
- ))} -
-
-
- - {/* Digitale Ausgänge */} -
-

- - Digitale Ausgänge -

- - - - - - - - - - - {digitalOutputs.map((output) => ( - - - - - - - ))} - -
AusgangBezeichnungSchalterAktion
- - {output.id} - {output.description} - toggleSwitch(output.id)} - className={`cursor-pointer text-2xl transform ${ - output.toggle - ? "text-blue-500 scale-x-100" - : "text-gray-500 scale-x-[-1]" - }`} - title={`Schalter ${output.toggle ? "EIN" : "AUS"} schalten`} - /> - - openOutputModal(output)} - /> -
-
- - {/* Modal für Eingänge */} - {isInputModalOpen && ( -
-
-

- Details für Eingang {selectedInput.id} -

-

- Status:{" "} - {selectedInput.status === "active" ? "Aktiv" : "Inaktiv"} -

-

- Beschreibung: {selectedInput.description} -

-

- Invertiert:{" "} - {selectedInput.isInverted ? "Ja" : "Nein"} -

- -
-
- )} - {/* Modal für Ausgänge */} - {isOutputModalOpen && ( -
-
-

- Details für Ausgang {selectedOutput.id} -

-

- Bezeichnung: {selectedOutput.description} -

-

- Status:{" "} - {selectedOutput.toggle ? "Eingeschaltet" : "Ausgeschaltet"} -

- -
-
- )} -
- ); -} - -export default EinAusgaenge;