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
@@ -557,6 +557,7 @@ const settings: TranslationStrings = {
'settings.apiScopes.hint':
'Lascia tutto attivo per una chiave che deve vedere ogni cosa. Ciò che disattivi viene rifiutato per questa chiave, non semplicemente omesso dalla risposta.',
'settings.apiScopes.all': 'Tutto',
'settings.apiScopes.noneSelected': 'Scegli almeno un\'area, altrimenti la chiave non potrebbe leggere nulla.',
'settings.apiScopes.limited': '{count} di {total}',
'settings.apiScopes.trips': 'Viaggi',
'settings.apiScopes.days': 'Giorni',
@@ -580,6 +581,11 @@ const settings: TranslationStrings = {
'settings.apiKeys.createFailed': 'Impossibile creare la chiave',
'settings.apiKeys.copy': 'Copia',
'settings.apiKeys.docsHint': 'Invia la chiave come "Authorization: Bearer ..." oppure "X-API-Key: ..." a /api/v1.',
'settings.apiKeys.endpoint': 'Endpoint',
'settings.apiKeys.neverUsed': 'mai usata',
'settings.apiKeys.loadFailed': 'Impossibile caricare le tue chiavi. Ricarica la pagina per riprovare.',
'settings.apiKeys.limitReached': 'Hai {max} chiavi, il massimo per un account. Eliminane una che non usi più per crearne un\'altra.',
'settings.apiKeys.copyFailed': 'Impossibile copiare. Seleziona il testo e copialo a mano.',
'settings.apiKeys.modal.createTitle': 'Crea chiave API',
'settings.apiKeys.modal.name': 'Nome',
'settings.apiKeys.modal.namePlaceholder': 'ad es. Dawarich',