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
@@ -558,6 +558,7 @@ const settings: TranslationStrings = {
'settings.apiScopes.hint':
'Залиште все увімкненим для ключа, який має бачити геть усе. Усе, що ви вимкнете, для цього ключа буде заборонено, а не просто пропущено у відповіді.',
'settings.apiScopes.all': 'Усе',
'settings.apiScopes.noneSelected': 'Виберіть принаймні один розділ, інакше ключ не зможе нічого прочитати.',
'settings.apiScopes.limited': '{count} з {total}',
'settings.apiScopes.trips': 'Подорожі',
'settings.apiScopes.days': 'Дні',
@@ -581,6 +582,11 @@ const settings: TranslationStrings = {
'settings.apiKeys.createFailed': 'Не вдалося створити ключ',
'settings.apiKeys.copy': 'Копіювати',
'settings.apiKeys.docsHint': 'Надсилайте ключ як "Authorization: Bearer ..." або "X-API-Key: ..." на /api/v1.',
'settings.apiKeys.endpoint': 'Ендпоінт',
'settings.apiKeys.neverUsed': 'не використовувався',
'settings.apiKeys.loadFailed': 'Не вдалося завантажити ключі. Оновіть сторінку, щоб спробувати ще раз.',
'settings.apiKeys.limitReached': 'У вас {max} ключів, це максимум для одного облікового запису. Видаліть непотрібний ключ, щоб створити новий.',
'settings.apiKeys.copyFailed': 'Не вдалося скопіювати. Виділіть текст і скопіюйте його вручну.',
'settings.apiKeys.modal.createTitle': 'Створити ключ API',
'settings.apiKeys.modal.name': 'Назва',
'settings.apiKeys.modal.namePlaceholder': 'напр. Dawarich',