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':
'Deixa-ho tot activat per a una clau que ho hagi de veure tot. El que desactivis es denega per a aquesta clau, no només es deixa fora de la resposta.',
'settings.apiScopes.all': 'Tot',
'settings.apiScopes.noneSelected': 'Tria almenys un àmbit; si no, la clau no podria llegir res.',
'settings.apiScopes.limited': '{count} de {total}',
'settings.apiScopes.trips': 'Viatges',
'settings.apiScopes.days': 'Dies',
@@ -583,6 +584,11 @@ const settings: TranslationStrings = {
'settings.apiKeys.createFailed': 'No s\'ha pogut crear la clau',
'settings.apiKeys.copy': 'Copia',
'settings.apiKeys.docsHint': 'Envia la clau com a "Authorization: Bearer ..." o "X-API-Key: ..." a /api/v1.',
'settings.apiKeys.endpoint': 'Endpoint',
'settings.apiKeys.neverUsed': 'mai utilitzada',
'settings.apiKeys.loadFailed': 'No s\'han pogut carregar les teves claus. Torna a carregar la pàgina per tornar-ho a provar.',
'settings.apiKeys.limitReached': 'Tens {max} claus, el màxim per compte. Esborra\'n una que ja no facis servir per crear-ne una altra.',
'settings.apiKeys.copyFailed': 'No s\'ha pogut copiar. Selecciona el text i copia\'l a mà.',
'settings.apiKeys.modal.createTitle': 'Crea una clau API',
'settings.apiKeys.modal.name': 'Nom',
'settings.apiKeys.modal.namePlaceholder': 'p. ex. Dawarich',