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
@@ -559,6 +559,7 @@ const settings: TranslationStrings = {
'settings.apiScopes.hint':
'Оставьте всё включённым для ключа, который должен видеть всё. Всё, что вы выключите, для этого ключа будет запрещено, а не просто опущено в ответе.',
'settings.apiScopes.all': 'Всё',
'settings.apiScopes.noneSelected': 'Выберите хотя бы один раздел, иначе ключ не сможет ничего прочитать.',
'settings.apiScopes.limited': '{count} из {total}',
'settings.apiScopes.trips': 'Поездки',
'settings.apiScopes.days': 'Дни',
@@ -582,6 +583,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',