feat(settings): collapsible settings cards, first on the integrations tab

The settings pages list everything at once, so they read as a wall of
forms. SettingsCard and Section take 'collapsible': the card starts shut
and its badge says its state ('Connected', 'Not set up'); its title is the
button, stretched over the head, the head's action stays its own button.
The body stays mounted while shut. A link to #id opens the card and
scrolls to it; the browser remembers a card left open.

Every integrations card is collapsible now; AI parsing shows its saved
model and MCP the apps signed in. The assistant's settings link opens the
AI connection card. Tests that read into a card open it first
(tests/helpers/settingsCards.ts).
This commit is contained in:
Maurice
2026-11-13 21:57:20 +01:00
parent 608f76f32c
commit 5fe3dea4cc
52 changed files with 355 additions and 16 deletions
@@ -4,6 +4,7 @@ import type { AiStatusResponse } from '@trek/shared';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { buildUser } from '../../../../tests/helpers/factories';
import { render, screen } from '../../../../tests/helpers/render';
import { openSettingsCards } from '../../../../tests/helpers/settingsCards';
import { resetAllStores, seedStore } from '../../../../tests/helpers/store';
import { useAddonStore } from '../../../store/addonStore';
import { useAssistantStore } from '../../../store/assistantStore';
@@ -30,6 +31,8 @@ const INSTANCE: AiStatusResponse = {
};
beforeEach(() => {
// The cards start shut; these tests read into them.
openSettingsCards();
resetAllStores();
vi.clearAllMocks();
useAssistantStore.setState({ status: null });
@@ -4,6 +4,7 @@ import type { AiConnectionView, AiStatusResponse } from '@trek/shared';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { buildAdmin, buildUser } from '../../../../tests/helpers/factories';
import { render, screen, waitFor } from '../../../../tests/helpers/render';
import { openSettingsCards } from '../../../../tests/helpers/settingsCards';
import { resetAllStores, seedStore } from '../../../../tests/helpers/store';
import { useAddonStore } from '../../../store/addonStore';
import { useAssistantStore } from '../../../store/assistantStore';
@@ -48,6 +49,8 @@ function status(over: Partial<AiStatusResponse> = {}): AiStatusResponse {
}
beforeEach(() => {
// The cards start shut; these tests read into them.
openSettingsCards();
resetAllStores();
vi.clearAllMocks();
useAssistantStore.setState({ status: null });
@@ -282,6 +282,8 @@ export default function AiConnectionSection({
return (
<Section
id="ai-connection"
collapsible
title={t(text.titleKey)}
icon={Sparkles}
hint={t(text.hintKey)}