feat: 1und 0 in Status in dashboard

This commit is contained in:
ISA
2025-06-30 14:59:29 +02:00
parent 971368045f
commit 268ed73cdd
6 changed files with 34 additions and 35 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.506
NEXT_PUBLIC_APP_VERSION=1.6.507
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.506
NEXT_PUBLIC_APP_VERSION=1.6.507
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.507] 2025-06-30
- feat: Dashboard Meldungen Status 1 oder 0
---
## [1.6.506] 2025-06-30
- feat: Redux-Integration für Meldungen, Anzeige von 'v' statt 's' in UI

View File

@@ -1,5 +1,4 @@
"use client";
// @/components/main/dashboard/Last20MessagesTable.tsx
import React, { useState, useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
@@ -14,27 +13,28 @@ type Meldung = {
i: string;
v: string;
};
export default function Last20MessagesTable() {
type Props = {
className?: string;
};
export default function Last20MessagesTable({ className }: Props) {
const dispatch = useDispatch<AppDispatch>();
type RootState = {
messages: {
data: Meldung[];
};
// add other slices if needed
};
const { data: messages } = useSelector((state: RootState) => state.messages);
const [sourceFilter, setSourceFilter] = useState<string>("Alle");
const [sourceFilter] = useState<string>("Alle");
// Datum initialisieren: von = heute - 30 Tage, bis = heute
const today = new Date();
const prior30 = new Date();
prior30.setDate(today.getDate() - 30);
const formatDate = (d: Date) => d.toISOString().split("T")[0];
const [fromDate, setFromDate] = useState<string>(formatDate(prior30));
const [toDate, setToDate] = useState<string>(formatDate(today));
const [fromDate] = useState<string>(formatDate(prior30));
const [toDate] = useState<string>(formatDate(today));
useEffect(() => {
dispatch(getMessagesThunk({ fromDate, toDate }));
@@ -46,11 +46,7 @@ export default function Last20MessagesTable() {
: messages.filter((m: Meldung) => m.i === sourceFilter);
return (
<div className="flex flex-col gap-3 p-4 w-full max-w-full h-[calc(100vh-13vh-8vh)] laptop:h-[calc(100vh-10vh-5vh)] xl:h-[calc(100vh-10vh-6vh)] laptop:gap-0">
<h1 className="text-xl font-bold mb-4"></h1>
<div className="flex flex-wrap gap-6 mb-6 items-end"></div>
<div className={`flex flex-col gap-3 p-4 ${className}`}>
<div className="overflow-auto max-h-[80vh]">
<table className="min-w-full border">
<thead className="bg-gray-100 text-left sticky top-0 z-10">
@@ -63,22 +59,20 @@ export default function Last20MessagesTable() {
</tr>
</thead>
<tbody>
{filteredMessages
.slice(0, 20)
.map((msg: Meldung, index: number) => (
<tr key={index} className="hover:bg-gray-50">
<td className="border p-2">
<div
className="w-4 h-4 rounded"
style={{ backgroundColor: msg.c }}
></div>
</td>
<td className="border p-2">{msg.t}</td>
<td className="border p-2">{msg.i}</td>
<td className="border p-2">{msg.m}</td>
<td className="border p-2">{msg.v}</td> {/* NEU */}
</tr>
))}
{filteredMessages.slice(0, 20).map((msg, index) => (
<tr key={index} className="hover:bg-gray-50">
<td className="border p-2">
<div
className="w-4 h-4 rounded"
style={{ backgroundColor: msg.c }}
></div>
</td>
<td className="border p-2">{msg.t}</td>
<td className="border p-2">{msg.i}</td>
<td className="border p-2">{msg.m}</td>
<td className="border p-2">{msg.v}</td>
</tr>
))}
</tbody>
</table>
{messages.length === 0 && (

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.506",
"version": "1.6.507",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.506",
"version": "1.6.507",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@iconify-icons/ri": "^1.2.10",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.506",
"version": "1.6.507",
"private": true,
"scripts": {
"dev": "next dev",