4.8 KiB
4.8 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 03-index-page-sliders | Per-row enable/disable slider on the integrations index page | done | 2 |
|
plan.md | ../../specs/integrations/requirements/enable-disable-toggle.md |
Task 03: Per-row enable/disable slider on the integrations index page
- Acceptance:
/settings/integrations(and its per-workspace equivalent, same component with aworkspaceIdprop) renders one slider per integration row for all seven integrations, each reflecting and persisting that integration'suseXEnabled()state.- No slider is nested inside a navigating
<a>— clicking a slider MUST NOT navigate to the integration's detail page; clicking the label/description MUST still navigate, exactly as before. apps/web/e2e/tests/integrations/integrations-index-layout-helpers.ts'sexpectStableIntegrationCardLayoutkeeps passing against the restructured cards.
- Verification:
cd apps && pnpm --filter @kandev/web test -- app/settings/integrations/pagethencd apps/web && pnpm e2e -- integrations-index-layout - Files likely touched:
apps/web/app/settings/integrations/page.tsxapps/web/app/settings/integrations/page.test.tsx(new)apps/web/e2e/tests/integrations/integrations-index-layout-helpers.ts
- Dependencies:
01-enabled-hooks. - Parallelism:
parallel-safewith02-own-page-sliders. NOT parallel-safe with04-hide-disabled-setting, which edits the samepage.tsx. - Inputs: spec "What"/scenarios, plan Task 03 section, existing card
markup + layout e2e test/helper,
drafted-integration-enabled-control.tsx. - Output contract: summary, files changed, exact test/e2e commands run and their output, blockers/risks, task/plan status update.
Results
- Restructured each card:
Cardis the outer element (no longer wrapped in a navigating<a>); the icon+label link and the per-integrationEnabledControlshare one top row (flex items-center justify-between gap-2), withEnabledControlrendered beside the title link rather than on a separate row below it, and the description is a separate link below that. This avoids nesting an interactive<Switch>inside an<a>(invalid DOM / fragile click propagation) without any absolute-positioning trick. - Selecting the right slider per row required one statically-imported
useXEnabledhook per component (rules of hooks forbid picking a hook dynamically by slug): addedENABLED_CONTROL_BY_SLUG: Record<IntegrationSlug, ComponentType>mapping each slug to its Task 01/02<XEnabledControl>component. - Iterated on the header layout under
expectStableIntegrationCardLayout's guard (MAX_ICON_TOP_INSET_PX) before landing on the final shape:- First attempt (slider inline with the label row,
items-center) pushed the icon down to a measured 31px inset (label text wrapped to 2 lines once squeezed by the slider pill) — rejected loosening the threshold; fixed the root cause instead. - Final shape (slider on its own row) reproduces the pre-existing
single-line title row exactly, measuring 19px — well under the original
22px budget. The budget in
integrations-index-layout-helpers.tswas not changed. - Verified via a temporary manual backend instance +
xd://browserDOM/screenshot inspection before re-running the real e2e spec each iteration; the temporary diagnostic spec file was deleted before finishing.
- First attempt (slider inline with the label row,
- Added
apps/web/app/settings/integrations/page.test.tsx: 4 tests (later extended to include Task 04's row — see task-04) covering slider count, initial checked state, label-click navigation, and slider-click non-navigation. - Updated
integrationCards()in the e2e helper to locate cards via[data-testid^="integration-card-"]directly instead of deriving them froma[href*="/integrations/"] > [data-slot="card"](no longer valid —Cardis not an anchor's child). - Commands:
cd apps && pnpm --filter @kandev/web test -- app/settings/integrations/page→Test Files 1 passed (1),Tests 3 passed (3)(pre-Task-04 state).cd apps/web && pnpm run typecheck→ clean.- E2E (via a managed background process,
apps/backend/bin/kandev+apps/web/distbuilt locally withmake build-backend/make build-web/make -C apps/backend e2e-plugin-package):npx playwright test --config e2e/playwright.config.ts e2e/tests/integrations/integrations-index-layout.spec.ts→1 passed.
- Files changed: the three files listed under "Files likely touched".
- Blockers/risks: none remaining. Risk noted and resolved: the initial layout regression (icon inset) was caught by the existing e2e test exactly as intended — the fix changed markup, not the test's tolerance.