Files
TREK/client/tests/helpers/settingsCards.ts
T
Maurice 5fe3dea4cc 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).
2026-11-13 21:57:20 +01:00

27 lines
966 B
TypeScript

import { settingsCardOpenKey } from '../../src/components/Settings/settingsKit';
/** The photo services the settings tests connect, each its own card (`photos-<id>`). */
const PHOTO_PROVIDERS = ['immich', 'synology', 'piwigo', 'nextcloud', 'google'];
/** Every collapsible card of the integrations tab, by the id it is linked and remembered by. */
export const INTEGRATION_CARDS: readonly string[] = [
'mail-import',
'airtrail',
'dawarich',
'wanderer',
'ai-connection',
'ai-parsing',
'api-keys',
'mcp',
...PHOTO_PROVIDERS.map((id) => `photos-${id}`),
];
/**
* Leaves settings cards open, as if their reader had left them so: a test then
* reads into a card without clicking its head first. Storage is cleared after
* every test (tests/setup.ts), so call it in a beforeEach.
*/
export function openSettingsCards(ids: readonly string[] = INTEGRATION_CARDS): void {
for (const id of ids) localStorage.setItem(settingsCardOpenKey(id), '1');
}