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
@@ -554,6 +554,7 @@ const settings: TranslationStrings = {
'settings.apiScopes.hint':
'Lämna allt påslaget för en nyckel som ska se allt. Det du stänger av nekas för den här nyckeln, det utelämnas inte bara ur svaret.',
'settings.apiScopes.all': 'Allt',
'settings.apiScopes.noneSelected': 'Välj minst ett område, annars kan nyckeln inte läsa någonting.',
'settings.apiScopes.limited': '{count} av {total}',
'settings.apiScopes.trips': 'Resor',
'settings.apiScopes.days': 'Dagar',
@@ -577,6 +578,11 @@ const settings: TranslationStrings = {
'settings.apiKeys.createFailed': 'Kunde inte skapa nyckeln',
'settings.apiKeys.copy': 'Kopiera',
'settings.apiKeys.docsHint': 'Skicka nyckeln som "Authorization: Bearer ..." eller "X-API-Key: ..." till /api/v1.',
'settings.apiKeys.endpoint': 'Ändpunkt',
'settings.apiKeys.neverUsed': 'aldrig använd',
'settings.apiKeys.loadFailed': 'Det gick inte att läsa in dina nycklar. Ladda om sidan för att försöka igen.',
'settings.apiKeys.limitReached': 'Du har {max} nycklar, det högsta antalet per konto. Ta bort en som du inte längre använder för att skapa en ny.',
'settings.apiKeys.copyFailed': 'Det gick inte att kopiera. Markera texten och kopiera den manuellt.',
'settings.apiKeys.modal.createTitle': 'Skapa API-nyckel',
'settings.apiKeys.modal.name': 'Namn',
'settings.apiKeys.modal.namePlaceholder': 't.ex. Dawarich',