feat(ai-settings): put Clear inside the API key field, drop the eye #20
Reference in New Issue
Block a user
Delete Branch "feat/api-key-clear-in-place-of-eye"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Each endpoint API-key
PasswordInput(Chat / LLM, Embeddings, Voice / STT) showed Mantine's built-in visibility toggle (the 'eye') plus a separate 'Clear' link below the field. The eye is useless: the key field is a write-only buffer — the stored key never loads back (the server only returnshasApiKey), so clicking the eye reveals an empty buffer.Change
Replace the eye with a Clear
ActionIconin the field'srightSection. Passing a customrightSectionsuppresses the built-in eye (Mantine). The Clear action appears only when a key is stored AND the buffer is empty (has*ApiKey && form.values.*ApiKey.length === 0); as soon as the user starts typing a new key, therightSectionfalls back toundefinedand the default eye returns — now it's useful (verify what was typed). After Clear, the handler setshas*ApiKey=false, so therightSectionflips back too. Self-consistent.Applied to all three endpoint cards. The old
<Stack>wrapper and<Anchor>Clear</Anchor>link are gone;Anchorremoved from the@mantine/coreimport (no remaining usages). The Clear icon-only button carriestype='button'(never submits) andaria-label.Out of scope (per plan)
Same pattern in the external MCP-server form (
ai-mcp-server-form.tsxAuthorization header field) — noted in the backlog as a possible follow-up for consistency.Verification
npx tsc --noEmit -p apps/client/tsconfig.json— clean.pnpm --filter client test— 58/58 pass (cosmetic change, no new tests).pnpm --filter client lint— pre-existing infrastructure failure (broken@tanstack/eslint-plugin-query); unrelated.