From 7ab4ea14c41c9e1b4742a2bf91c0805663384601 Mon Sep 17 00:00:00 2001 From: RobbStarkAustria <7694336+RobbStarkAustria@users.noreply.github.com> Date: Sun, 12 Oct 2025 05:23:10 +0000 Subject: [PATCH] Polish up clients ui --- .github/copilot-instructions.md | 4 + dashboard/src/appointments.tsx | 2 +- dashboard/src/clients.tsx | 236 +++++++++---------- dashboard/src/components/SetupModeButton.tsx | 13 +- dashboard/src/dashboard.tsx | 8 +- dashboard/src/infoscreen_groups.tsx | 2 +- dashboard/tailwind.config.cjs | 10 - 7 files changed, 131 insertions(+), 144 deletions(-) delete mode 100644 dashboard/tailwind.config.cjs diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1c63d54..15503c2 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,5 +1,9 @@ # Copilot instructions for infoscreen_2025 +# Purpose +These instructions tell Copilot Chat how to reason about this codebase. +Prefer explanations and refactors that align with these structures. + Use this as your shared context when proposing changes. Keep edits minimal and match existing patterns referenced below. ## Big picture diff --git a/dashboard/src/appointments.tsx b/dashboard/src/appointments.tsx index 8f3ac47..6be0b5a 100644 --- a/dashboard/src/appointments.tsx +++ b/dashboard/src/appointments.tsx @@ -387,7 +387,7 @@ const Appointments: React.FC = () => { return (
-

Terminmanagement

+

Terminmanagement

; - onClose: () => void; -} - -function DetailsModal({ open, client, groupIdToName, onClose }: DetailsModalProps) { - if (!open || !client) return null; +// Details dialog renders via Syncfusion Dialog for consistent look & feel +function DetailsContent({ client, groupIdToName }: { client: Client; groupIdToName: Record }) { return ( -
-
-
-

Client-Details

- - - {Object.entries(client) - .filter( - ([key]) => - ![ - 'index', - 'is_active', - 'type', - 'column', - 'group_name', - 'foreignKeyData', - 'hardware_token', - ].includes(key) - ) - .map(([key, value]) => ( - - - - - ))} - -
- {key === 'group_id' - ? 'Raumgruppe' - : key === 'ip' - ? 'IP-Adresse' - : key === 'registration_time' - ? 'Registriert am' - : key === 'description' - ? 'Beschreibung' - : key === 'last_alive' - ? 'Letzter Kontakt' - : key === 'model' - ? 'Modell' - : key === 'uuid' - ? 'Client-Code' - : key === "os_version" - ? 'Betriebssystem' - : key === 'software_version' - ? 'Clientsoftware' - : key === 'macs' - ? 'MAC-Adressen' - : key.charAt(0).toUpperCase() + key.slice(1)} - : - - {key === 'group_id' - ? value !== undefined - ? groupIdToName[value as string | number] || value - : '' - : key === 'registration_time' && value - ? new Date( - (value as string).endsWith('Z') ? (value as string) : value + 'Z' - ).toLocaleString() - : key === 'last_alive' && value - ? String(value) // Wert direkt anzeigen, nicht erneut parsen - : String(value)} -
-
- -
-
-
+
+ + + {Object.entries(client) + .filter( + ([key]) => + ![ + 'index', + 'is_active', + 'type', + 'column', + 'group_name', + 'foreignKeyData', + 'hardware_token', + ].includes(key) + ) + .map(([key, value]) => ( + + + + + ))} + +
+ {key === 'group_id' + ? 'Raumgruppe' + : key === 'ip' + ? 'IP-Adresse' + : key === 'registration_time' + ? 'Registriert am' + : key === 'description' + ? 'Beschreibung' + : key === 'last_alive' + ? 'Letzter Kontakt' + : key === 'model' + ? 'Modell' + : key === 'uuid' + ? 'Client-Code' + : key === 'os_version' + ? 'Betriebssystem' + : key === 'software_version' + ? 'Clientsoftware' + : key === 'macs' + ? 'MAC-Adressen' + : key.charAt(0).toUpperCase() + key.slice(1)} + + {key === 'group_id' + ? value !== undefined + ? groupIdToName[value as string | number] || String(value) + : '' + : key === 'registration_time' && value + ? new Date( + (value as string).endsWith('Z') ? (value as string) : String(value) + 'Z' + ).toLocaleString() + : key === 'last_alive' && value + ? String(value) + : key === 'macs' && typeof value === 'string' + ? value.replace(/,\s*/g, ', ') + : String(value)} +
); } @@ -154,31 +120,38 @@ const Clients: React.FC = () => { // DataGrid row template für Details- und Entfernen-Button const detailsButtonTemplate = (props: Client) => ( -
- - +
); return ( -
-
-

Client-Übersicht

+
+
+

+ Client-Übersicht +

{groups.length > 0 ? ( @@ -190,7 +163,7 @@ const Clients: React.FC = () => { toolbar={['Search', 'Edit', 'Update', 'Cancel']} allowSorting={true} allowFiltering={true} - height={400} + height={420} editSettings={{ allowEditing: true, allowAdding: false, @@ -228,17 +201,17 @@ const Clients: React.FC = () => { width="140" /> - + - + { - setDetailsClient(null)} - /> ) : ( -
Raumgruppen werden geladen ...
+ Raumgruppen werden geladen ... )} - {/* DialogComponent für Bestätigung */} + + {/* Details-Dialog */} + {detailsClient && ( + setDetailsClient(null)} + footerTemplate={() => ( +
+ setDetailsClient(null)}>{'Schließen'} +
+ )} + > + +
+ )} + + {/* Bestätigungs-Dialog für Löschen */} {showDialog && deleteClientId && ( { content="Möchten Sie diesen Client wirklich entfernen?" showCloseIcon={true} width="400px" + target="#dialog-target" buttons={[ { click: confirmDelete, buttonModel: { content: 'Ja', isPrimary: true } }, { click: cancelDelete, buttonModel: { content: 'Abbrechen' } }, diff --git a/dashboard/src/components/SetupModeButton.tsx b/dashboard/src/components/SetupModeButton.tsx index b254cb3..7c84e58 100644 --- a/dashboard/src/components/SetupModeButton.tsx +++ b/dashboard/src/components/SetupModeButton.tsx @@ -1,18 +1,21 @@ import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Wrench } from 'lucide-react'; +import { ButtonComponent } from '@syncfusion/ej2-react-buttons'; const SetupModeButton: React.FC = () => { const navigate = useNavigate(); return ( - + + + Erweiterungsmodus + + ); }; diff --git a/dashboard/src/dashboard.tsx b/dashboard/src/dashboard.tsx index 0e820a6..379349f 100644 --- a/dashboard/src/dashboard.tsx +++ b/dashboard/src/dashboard.tsx @@ -171,10 +171,12 @@ const Dashboard: React.FC = () => { return (
-
-

Dashboard

+
+

Dashboard

-

Raumgruppen Übersicht

+

+ Raumgruppen Übersicht +

{ return (
-

{de.title}

+

{de.title}