From 03c434dc5a6bc6deefeea3cec557418ac179ff2a Mon Sep 17 00:00:00 2001 From: Ismail Ali Date: Thu, 13 Feb 2025 21:02:34 +0100 Subject: [PATCH] =?UTF-8?q?last20Messages=20von=20Redux=20bekommen,=20so?= =?UTF-8?q?=20wird=20=C3=9Cbergabparameter=20und=20props=20nicht=20brauche?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/uebersicht/Last20MessagesTable.tsx | 34 +++++++++++++++---- config/webVersion.ts | 2 +- pages/dashboard.tsx | 2 +- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/components/main/uebersicht/Last20MessagesTable.tsx b/components/main/uebersicht/Last20MessagesTable.tsx index 6444575..710d032 100644 --- a/components/main/uebersicht/Last20MessagesTable.tsx +++ b/components/main/uebersicht/Last20MessagesTable.tsx @@ -1,13 +1,35 @@ "use client"; import React from "react"; +import { useSelector } from "react-redux"; +import { RootState } from "../../../redux/store"; -interface Last20MessagesTableProps { - last20Messages: string[][]; -} +const Last20MessagesTable: React.FC = () => { + const rawLast20Messages = useSelector( + (state: RootState) => state.variables.last20Messages + ); + + // Hilfsfunktion zum Parsen der Nachrichten + const parseMessages = (messages: string | null) => { + if (typeof messages === "string") { + messages = messages + .replace(//g, "\n") + .replace(/<\/?td>/g, "") + .replace(/<\/tr>/g, "") + .trim(); + const rows = messages.split("\n"); + return rows.map((row) => [ + row.substring(0, 5), + row.substring(5, 10), + row.substring(10, 29), + row.substring(33, row.length - 1), + row.substring(row.length - 1), + ]); + } + return []; + }; + + const last20Messages = parseMessages(rawLast20Messages); -const Last20MessagesTable: React.FC = ({ - last20Messages, -}) => { return (
diff --git a/config/webVersion.ts b/config/webVersion.ts index 26711bd..aad6439 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -5,5 +5,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.20"; +const webVersion = "1.6.21"; export default webVersion; diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index 2ac2407..1b78dc6 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -159,7 +159,7 @@ function Dashboard() {
- +