[Story-1120] Matter Templates settings — list + detail (create/edit, 3-catalog multi-select)

Story 1120Epic None61 files · +2510/−1416

PR #277 · pramaan-io/pramaan-app · merged 2026-06-09

Why this matters

Matter templates had no settings surface — admins couldn't create, edit, or retire them without breaking the schema.

A frozen read-only list is not governance.

Partial PATCH silently desyncs frozen snapshots — old matters keep stale defaults, and the firm has no idea.

The fix — Save the full recipe card every time — never the margin.

How it flows

sequenceDiagram
  autonumber
  participant admin as Admin
  participant ui as List + Detail UI
  participant gw as Gateway
  participant srv as Server
  admin->>ui: Open list, click a template
  ui-->>gw: List query (RSC prefetch)
  admin->>ui: Edit name, pick chips from 3 catalogs
  ui->>ui: Snapshot callout warns the admin
  ui->>gw: PATCH the full replacement set
  gw->>srv: assertContract + persist
  gw-->>ui: Invalidate the list query key

Files changed (61)

File±
docs/walkthroughs/story-1120-walkthrough.html+249
messages/en.json+64
messages/hi.json+64
src/app/[locale]/(workspace)/settings/matter-configuration/matter-templates/[matterTemplateId]/page.tsx+31 −8
src/app/[locale]/(workspace)/settings/matter-configuration/matter-templates/new/page.tsx+38
src/app/[locale]/(workspace)/settings/matter-configuration/matter-templates/page.tsx+38 −25
src/app/api/internal/matter-templates/[matterTemplateId]/archive/route.ts+13
src/app/api/internal/matter-templates/[matterTemplateId]/route.ts+76
src/app/api/internal/matter-templates/[matterTemplateId]/unarchive/route.ts+13
src/app/api/internal/matter-templates/route.ts+48 −6
src/components/settings/matter-types/AGENTS.md+104
src/components/settings/matter-types/CLAUDE.md+1
src/components/settings/matter-types/catalog-chip-multi-select.stories.tsx+62
src/components/settings/matter-types/catalog-chip-multi-select.tsx+88
src/components/settings/matter-types/matter-template-delete-dialog.tsx+50
src/components/settings/matter-types/matter-template-detail-actions.tsx+106
src/components/settings/matter-types/matter-template-detail-header.stories.tsx+44
src/components/settings/matter-types/matter-template-detail-header.tsx+46
src/components/settings/matter-types/matter-template-detail-page.tsx ★+132
src/components/settings/matter-types/matter-template-form-fields.tsx+125
src/components/settings/matter-types/matter-template-setup-guide-parts.tsx+0 −56
src/components/settings/matter-types/matter-template-setup-guide.tsx+0 −64
src/components/settings/matter-types/matter-template-snapshot-callout.stories.tsx+27
src/components/settings/matter-types/matter-template-snapshot-callout.tsx+26
src/components/settings/matter-types/matter-templates-fixtures.ts+97
src/components/settings/matter-types/matter-templates-list-page.tsx+132
src/components/settings/matter-types/matter-templates-presentation.ts+49
src/components/settings/matter-types/matter-templates-table.stories.tsx+97
src/components/settings/matter-types/matter-templates-table.tsx ★+182
src/components/settings/matter-types/matter-templates-toolbar.tsx+55
src/components/settings/matter-types/matter-templates-types.ts+8
src/components/settings/matter-types/matter-type-add-sheet.tsx+0 −69
src/components/settings/matter-types/matter-type-detail-actions.tsx+0 −74
src/components/settings/matter-types/matter-type-detail-cards.tsx+0 −76
src/components/settings/matter-types/matter-type-detail-content.tsx+0 −68
src/components/settings/matter-types/matter-type-detail-header.tsx+0 −35
src/components/settings/matter-types/matter-type-form-fields.tsx+0 −40
src/components/settings/matter-types/matter-type-form-model.ts+0 −36
src/components/settings/matter-types/matter-type-overview.tsx+0 −44
src/components/settings/matter-types/matter-type-sheet-header.tsx+0 −25
src/components/settings/matter-types/matter-types-empty-state.tsx+0 −59
src/components/settings/matter-types/matter-types-list-content.tsx+0 −59
src/components/settings/matter-types/matter-types-list-parts.tsx+0 −56
src/components/settings/matter-types/matter-types-list-row.tsx+0 −48
src/components/settings/matter-types/matter-types-list-table.tsx+0 −49
src/components/settings/matter-types/matter-types-page.stories.tsx+0 −71
src/components/settings/matter-types/matter-types-story-drawers.tsx+0 −35
src/components/settings/matter-types/matter-types-story-surface.tsx+0 −57
src/components/settings/matter-types/matter-types-story-types.ts+0 −1
src/components/settings/matter-types/presentation.ts+5 −36
src/components/settings/matter-types/story-fixtures.ts+0 −98
src/components/settings/matter-types/use-matter-template-actions.ts ★+143
src/components/settings/matter-types/use-matter-template-form.ts+123
src/components/settings/matter-types/use-matter-type-sheet-form.ts+0 −50
src/lib/kubb-client.ts+13 −1
src/lib/matter-templates/catalog-prefetch.ts+37
src/lib/matter-templates/gateway.ts+100 −9
src/lib/matter-templates/types.ts+12
tests/unit/matter-types-content.test.tsx+0 −154
tests/unit/matter-types-contract.test.ts+8 −6
tests/unit/matter-types-internal-route.test.ts+4 −1