PR: #328: [Story-1283] Matter Types settings catalog — Storybook-first mock scaffold by @ankitmaheshwari-com
View PR →
Story-1283 · Matter Types · Spike-1274 · pramaan-docs ADR-115

Matter Types settings catalog — Storybook-first mock scaffold

A new Matter Types settings catalog, built by cloning the proven proceeding-types catalog pattern file-for-file. It is deliberately mock-backed: the page and stories run entirely off fixtures, so this slice ships and merges independent of the functions backend chain (#1277 → #1278 → #1279). No codegen, no @/gen import, no gateway, no /api/internal/matter-types route. Story-1281 stays the wiring ticket — it swaps the local type for the generated MatterTypeView and a real /app/matter-types gateway once #1278 lands.

The decoupling seam

The whole point is one boundary: a LOCAL MatterType interface in src/lib/matter-types/types.ts, mirroring the decided matter_types shape (id, name, availability, canDelete, isInUse, matterTypeNumberFormatted = "TY-001", …). It carries the exact wire-up TODO and a justified no-restricted-syntax disable — the rule normally forces DTOs from src/gen/; this is the temporary local seam, not a contract mirror. Fixtures feed both the page and the stories.

What was built (cloned file-for-file)

PieceWhat & why
List pagematter-type-catalog-list-page.tsx — Live/Archived tabs, name/description search, + Add matter type, pagination. Owns rows in local useState (seeded from fixtures) since there is no list query yet; story-only initialMatterTypes/Query/Filter props drive the empty / no-match / archived states.
Table + row-table.tsx / -table-row.tsx — shared grid chrome, StatusBadge (live/archived), TY- reference, Updated→Archived column swap, empty-state.
Sheet-sheet.tsx / -sheet-fields.tsx — create/edit drawer on react-hook-form + zod, against local form state. No network.
Dialog + actions-delete-dialog.tsx, -row-actions.tsx — edit / archive / restore / delete-when-unused (delete disabled + steered to archive when canDelete: false).
Hooks (mock)use-matter-type-catalog-actions.ts + use-matter-type-catalog-sheet.tsx — mutate the page's local fixture state synchronously and confirm with a toast. These are the only files that diverge from the gold pattern: the @/gen TanStack mutations are replaced by setState.
Presentation-presentation.ts (counts + tab/search filter) + src/lib/matter-types/presentation.ts (date format).
Fixtures-fixtures.ts — the canonical seed list (Civil Suit … Other) + one archived row; isInUse/canDelete varied so the row menu shows every state.
Storieslist-page (live / read-only / archived / empty / search-no-match), table (7 states), sheet (add / edit / saving / error). The review deliverable.
Route stubsettings/matter-configuration/matter-types/page.tsx — renders the list-page off fixtures, real settings:write gate, clearly marked MOCK. No loader.
i18nNew MatterTypes namespace, 41 keys, full en + hi parity. No hardcoded strings.

Verification

pnpm typecheck   clean
pnpm lint        clean (new files)
vitest           matter-type-catalog-presentation.test.ts — 8 passed
storybook build  completed successfully
i18n parity      en/hi MatterTypes — 41 keys each
scans            no hardcoded copy; no color literals
Stayed in scope: cloned the gold catalog pattern, prefixed every new file matter-type-catalog-* to avoid the matter-template/preset squat in the shared matter-types/ dir. No codegen, no @/gen, no gateway — the PR stays green against the contract drift-guard.
Out of scope (deferred to #1281): real /app/matter-types wiring (generated MatterTypeView + gateway + proxy + optimistic TanStack writes), the Matter Preset relabel, the Add-Matter wizard picker + inline-create, settings-nav subtitles. The full package de-squat of matter-types/ is #1277.

Files changed

84 file(s), +7716 / -1423 lines

Path Role + -
messages/en.jsonConfig+76-31
messages/hi.jsonConfig+76-31
openapi/app-api.jsonConfig+2243-1232
src/app/[locale]/(workspace)/matters/page.tsxApp route+8-4
src/app/[locale]/(workspace)/settings/matter-configuration/matter-types/page.tsxApp route+25-0
src/components/add-matter/add-matter-shell.tsxComponent+6-6
src/components/add-matter/add-matter-types.tsComponent+8-0
src/components/add-matter/add-matter-wizard.tsxComponent+1-1
src/components/add-matter/count-line.tsxComponent+3-3
src/components/add-matter/step1-template-body.tsxComponent+20-9
src/components/add-matter/step2-matter-body.tsxComponent+90-72
src/components/add-matter/template-row.tsxComponent+27-17
src/components/settings/matter-types/matter-type-catalog-delete-dialog.tsxComponent+50-0
src/components/settings/matter-types/matter-type-catalog-fixtures.tsComponent+145-0
src/components/settings/matter-types/matter-type-catalog-list-page.stories.tsxComponent+55-0
src/components/settings/matter-types/matter-type-catalog-list-page.tsxComponent+132-0
src/components/settings/matter-types/matter-type-catalog-presentation.test.tsComponent+86-0
src/components/settings/matter-types/matter-type-catalog-presentation.tsComponent+34-0
src/components/settings/matter-types/matter-type-catalog-row-actions.tsxComponent+75-0
src/components/settings/matter-types/matter-type-catalog-sheet-fields.tsxComponent+76-0
src/components/settings/matter-types/matter-type-catalog-sheet.stories.tsxComponent+58-0
src/components/settings/matter-types/matter-type-catalog-sheet.tsxComponent+103-0
src/components/settings/matter-types/matter-type-catalog-table-layout.tsComponent+6-0
src/components/settings/matter-types/matter-type-catalog-table-row.tsxComponent+86-0
src/components/settings/matter-types/matter-type-catalog-table.stories.tsxComponent+99-0
src/components/settings/matter-types/matter-type-catalog-table.tsxComponent+67-0
src/components/settings/matter-types/matter-type-catalog-toolbar.tsxComponent+55-0
src/components/settings/matter-types/matter-type-catalog-types.tsComponent+21-0
src/components/settings/matter-types/proceedings-story-content.tsxComponent+1-1
src/components/settings/matter-types/use-matter-type-catalog-actions.tsComponent+55-0
src/components/settings/matter-types/use-matter-type-catalog-sheet.tsxComponent+133-0
src/components/settings/settings-sidebar.tsxComponent+17-3
src/components/shared/user-rail-button.tsxComponent+28-6
src/gen/client/appArchiveMatterType.tsGenerated contract+65-0
src/gen/client/appCreateMatterType.tsGenerated contract+68-0
src/gen/client/appDeleteMatterType.tsGenerated contract+65-0
src/gen/client/appListMatterTypes.tsGenerated contract+57-0
src/gen/client/appUnarchiveMatterType.tsGenerated contract+65-0
src/gen/client/appUpdateMatterType.tsGenerated contract+75-0
src/gen/client/index.tsGenerated contract+6-0
src/gen/hooks/index.tsGenerated contract+28-0
src/gen/hooks/useAppArchiveMatterType.tsGenerated contract+152-0
src/gen/hooks/useAppCreateMatterType.tsGenerated contract+156-0
src/gen/hooks/useAppDeleteMatterType.tsGenerated contract+152-0
src/gen/hooks/useAppListMatterTypes.tsGenerated contract+119-0
src/gen/hooks/useAppListMatterTypesSuspense.tsGenerated contract+117-0
src/gen/hooks/useAppUnarchiveMatterType.tsGenerated contract+152-0
src/gen/hooks/useAppUpdateMatterType.tsGenerated contract+162-0
src/gen/index.tsGenerated contract+197-0
src/gen/schemas/matterTypeAvailability.jsonGenerated contract+7-0
src/gen/schemas/matterTypeCreateRequest.jsonGenerated contract+21-0
src/gen/schemas/matterTypeListItem.jsonGenerated contract+107-0
src/gen/schemas/matterTypeListResponse.jsonGenerated contract+126-0
src/gen/schemas/matterTypeUpdateRequest.jsonGenerated contract+34-0
src/gen/schemas/matterTypeView.jsonGenerated contract+108-0
src/gen/types/AppArchiveMatterType.tsGenerated contract+76-0
src/gen/types/AppCreateMatterType.tsGenerated contract+75-0
src/gen/types/AppDeleteMatterType.tsGenerated contract+74-0
src/gen/types/AppListMatterTypes.tsGenerated contract+64-0
src/gen/types/AppUnarchiveMatterType.tsGenerated contract+76-0
src/gen/types/AppUpdateMatterType.tsGenerated contract+83-0
src/gen/types/MatterTypeAvailability.tsGenerated contract+13-0
src/gen/types/MatterTypeCreateRequest.tsGenerated contract+22-0
src/gen/types/MatterTypeListItem.tsGenerated contract+87-0
src/gen/types/MatterTypeListResponse.tsGenerated contract+18-0
src/gen/types/MatterTypeUpdateRequest.tsGenerated contract+25-0
src/gen/types/MatterTypeView.tsGenerated contract+88-0
src/gen/types/index.tsGenerated contract+86-0
src/gen/zod/appArchiveMatterTypeSchema.tsGenerated contract+98-0
src/gen/zod/appCreateMatterTypeSchema.tsGenerated contract+99-0
src/gen/zod/appDeleteMatterTypeSchema.tsGenerated contract+94-0
src/gen/zod/appListMatterTypesSchema.tsGenerated contract+81-0
src/gen/zod/appUnarchiveMatterTypeSchema.tsGenerated contract+98-0
src/gen/zod/appUpdateMatterTypeSchema.tsGenerated contract+104-0
src/gen/zod/index.tsGenerated contract+77-0
src/gen/zod/matterTypeAvailabilitySchema.tsGenerated contract+17-0
src/gen/zod/matterTypeCreateRequestSchema.tsGenerated contract+17-0
src/gen/zod/matterTypeListItemSchema.tsGenerated contract+66-0
src/gen/zod/matterTypeListResponseSchema.tsGenerated contract+17-0
src/gen/zod/matterTypeUpdateRequestSchema.tsGenerated contract+30-0
src/gen/zod/matterTypeViewSchema.tsGenerated contract+73-0
src/lib/matter-types/presentation.tsLibrary+15-0
src/lib/matter-types/types.tsLibrary+32-0
tests/unit/live-matter-fields.test.tsxTest+7-7