From cdb2443d8f62b67cd08ee4df62c1c15e5b671046 Mon Sep 17 00:00:00 2001 From: cynfo3000 Date: Tue, 10 Mar 2026 00:34:42 +0100 Subject: [PATCH] refactor: API-Keys in Einstellungen kompakter (gleicher Stil wie Kunden-Panel) --- frontend/src/pages/SettingsPage.jsx | 82 ++++++++++++++--------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/src/pages/SettingsPage.jsx b/frontend/src/pages/SettingsPage.jsx index f9c8fd3..79289ba 100644 --- a/frontend/src/pages/SettingsPage.jsx +++ b/frontend/src/pages/SettingsPage.jsx @@ -349,55 +349,55 @@ function APIKeysSection() { {/* Key Liste */} {loading ? ( -
Laden...
+
Laden...
) : keys.length === 0 ? ( -
Keine API-Keys vorhanden
+
Keine API-Keys vorhanden
) : ( -
+
{keys.map((k) => { const perm = PERM_LABELS[k.permissions] || PERM_LABELS.read const customer = k.customer_id ? customers.find(c => c.id === k.customer_id) : null + const lastUsedAgo = k.last_used + ? (() => { + const s = (Date.now() - new Date(k.last_used)) / 1000 + if (s < 120) return 'gerade eben' + if (s < 3600) return `${Math.floor(s/60)}m` + if (s < 86400) return `${Math.floor(s/3600)}h` + return `${Math.floor(s/86400)}d` + })() + : null return ( -
-
-
- {k.name} - - {perm.label} +
+ + {perm.label} + + {k.name} + {customer && ( + {customer.number} + )} + + {k.key.substring(0, 8)}…{k.key.substring(k.key.length - 4)} + + {lastUsedAgo && ( + + {lastUsedAgo} - {customer && ( - - {customer.number} - - )} -
-
- {k.key.substring(0, 8)}...{k.key.substring(k.key.length - 4)} - - - Erstellt: {new Date(k.created_at).toLocaleDateString('de-DE')} - - {k.last_used && ( - - Zuletzt: {new Date(k.last_used).toLocaleString('de-DE')} - - )} -
+ )} + +
- -
) })}