fix(settings): bring the API keys section and its dialog in line with the rest of TREK

The section stacked a lonely button, a centred line and a small print hint
on top of each other, and the create dialog used bare browser checkboxes
that ignore the accent. The dialog now runs on the shared Modal with
selectable scope tiles, keys render as cards with their scopes as chips,
deletion goes through ConfirmDialog, and the endpoint sits in its own row
with a copy button.

Pressing Enter in the name field with every scope switched off used to
create a key: the empty list was dropped from the request and the server
stored it as a key that reads everything. Creation is now refused until at
least one scope is picked.

A failed list load no longer reads as "no keys yet", the create button
stops at the server's limit of ten keys, a refused clipboard says so, and
SQLite timestamps are parsed so Safari does not show Invalid Date.
This commit is contained in:
Maurice
2026-09-14 21:59:27 +02:00
parent da679e6266
commit 25282ea1c5
25 changed files with 648 additions and 220 deletions
+6
View File
@@ -560,6 +560,7 @@ const settings: TranslationStrings = {
'settings.apiScopes.hint':
'Lass alles an, wenn der Schlüssel alles sehen soll. Was du abschaltest, wird für diesen Schlüssel abgelehnt und nicht nur aus der Antwort weggelassen.',
'settings.apiScopes.all': 'Alles',
'settings.apiScopes.noneSelected': 'Wähle mindestens einen Bereich, sonst dürfte der Schlüssel gar nichts lesen.',
'settings.apiScopes.limited': '{count} von {total}',
'settings.apiScopes.trips': 'Reisen',
'settings.apiScopes.days': 'Tage',
@@ -583,6 +584,11 @@ const settings: TranslationStrings = {
'settings.apiKeys.createFailed': 'Schlüssel konnte nicht erstellt werden',
'settings.apiKeys.copy': 'Kopieren',
'settings.apiKeys.docsHint': 'Schicke den Schlüssel als "Authorization: Bearer ..." oder "X-API-Key: ..." an /api/v1.',
'settings.apiKeys.endpoint': 'Endpunkt',
'settings.apiKeys.neverUsed': 'nie genutzt',
'settings.apiKeys.loadFailed': 'Deine Schlüssel konnten nicht geladen werden. Lade die Seite neu, um es noch einmal zu versuchen.',
'settings.apiKeys.limitReached': 'Du hast {max} Schlüssel, mehr geht pro Konto nicht. Lösche einen, den du nicht mehr brauchst, um einen neuen zu erstellen.',
'settings.apiKeys.copyFailed': 'Kopieren hat nicht geklappt. Markiere den Text und kopiere ihn von Hand.',
'settings.apiKeys.modal.createTitle': 'API-Schlüssel erstellen',
'settings.apiKeys.modal.name': 'Name',
'settings.apiKeys.modal.namePlaceholder': 'z. B. Dawarich',