From 99a6212e04feab18fe893272bec2efbb64c3666d Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 27 Sep 2024 08:39:26 +0200 Subject: [PATCH] CPL, Access 1 und Access 2 Status Komponente erstellt --- app/dashboard/page.jsx | 39 ++++++++++++++++++------------------ components/Access1Status.jsx | 17 ++++++++++++++++ components/Access2Status.jsx | 17 ++++++++++++++++ components/CPLStatus.jsx | 17 ++++++++++++++++ components/Header.jsx | 4 ---- 5 files changed, 70 insertions(+), 24 deletions(-) create mode 100644 components/Access1Status.jsx create mode 100644 components/Access2Status.jsx create mode 100644 components/CPLStatus.jsx diff --git a/app/dashboard/page.jsx b/app/dashboard/page.jsx index 44eba45..9c31b85 100644 --- a/app/dashboard/page.jsx +++ b/app/dashboard/page.jsx @@ -1,24 +1,31 @@ -// app/dashboard/page.jsx -"use client"; +"use client"; // app/dashboard/page.jsx import React, { useEffect, useState } from "react"; import "tailwindcss/tailwind.css"; import "@fontsource/roboto"; import "bootstrap-icons/font/bootstrap-icons.css"; -import { loadWindowVariables } from "../../utils/loadWindowVariables"; // Importiere die Funktion +import { loadWindowVariables } from "../../utils/loadWindowVariables"; +import CPLStatus from "../../components/CPLStatus"; +import Access1Status from "../../components/Access1Status"; +import Access2Status from "../../components/Access2Status"; function Dashboard() { const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL; const [last20Messages, setLast20Messages] = useState([]); + const [ip, setIp] = useState(""); + const [subnet, setSubnet] = useState(""); + const [gateway, setGateway] = useState(""); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { loadWindowVariables(apiUrl) .then(() => { - // Jetzt sind die Variablen im window-Objekt verfügbar if (window.last20Messages) { const parsedMessages = parseMessages(window.last20Messages); setLast20Messages(parsedMessages); + setIp(window.ip); + setSubnet(window.subnet); + setGateway(window.gateway); } else { console.error("Konnte last20Messages nicht finden."); setError("Konnte last20Messages nicht finden."); @@ -32,7 +39,6 @@ function Dashboard() { }); }, [apiUrl]); - // Nachrichten parsen const parseMessages = (messages) => { messages = messages .replace(//g, "\n") @@ -131,11 +137,11 @@ function Dashboard() { {/* Beispiel für Geräteanzeige */}
-

- Geräte Status -

-

Server: Online

-

Access 1: Online

+
+ + + +
@@ -146,7 +152,7 @@ function Dashboard() { IP Address

IP-Adresse

-

192.168.10.147

+

{ip}

@@ -157,21 +163,14 @@ function Dashboard() { />

Subnet-Maske

-

255.255.255.0

+

{subnet}

gateway

Gateway

-

192.168.10.1

-
-
-
- IEC -
-

IEC-Adresse

-

223

+

{gateway}

diff --git a/components/Access1Status.jsx b/components/Access1Status.jsx new file mode 100644 index 0000000..ffa1043 --- /dev/null +++ b/components/Access1Status.jsx @@ -0,0 +1,17 @@ +// components/Access1Status.jsx +import React from "react"; + +const Access1Status = () => { + return ( +
+ {/* Grüner Streifen auf der linken Seite */} +
+ {/* Blauer Hauptbereich */} +
+ Access 1 +
+
+ ); +}; + +export default Access1Status; diff --git a/components/Access2Status.jsx b/components/Access2Status.jsx new file mode 100644 index 0000000..4ff2450 --- /dev/null +++ b/components/Access2Status.jsx @@ -0,0 +1,17 @@ +// components/Access2Status.jsx +import React from "react"; + +const Access2Status = () => { + return ( +
+ {/* Grüner Streifen auf der linken Seite */} +
+ {/* Blauer Hauptbereich */} +
+ Access 2 +
+
+ ); +}; + +export default Access2Status; diff --git a/components/CPLStatus.jsx b/components/CPLStatus.jsx new file mode 100644 index 0000000..da8d2a0 --- /dev/null +++ b/components/CPLStatus.jsx @@ -0,0 +1,17 @@ +// components/CPLStatus.jsx +import React from "react"; + +const CPLStatus = () => { + return ( +
+ {/* Grüner Streifen auf der linken Seite */} +
+ {/* Blauer Hauptbereich */} +
+ CPL +
+
+ ); +}; + +export default CPLStatus; diff --git a/components/Header.jsx b/components/Header.jsx index 8242418..5d79b36 100644 --- a/components/Header.jsx +++ b/components/Header.jsx @@ -45,10 +45,6 @@ function Header() {

Stationsname

{stationsname}

-
-

CPL Status

- {cplStatus} -
{/* Temperatur und Icons */}