PR: #708: feat(matters): require add-matter lead picker [Story-2674]
by @ayush-pramaan
View PR →
Story-2674 - Matter Team A4
Add Matter now requires a lead counsel pick
The Add Matter drawer keeps lead counsel as a create-time decision for both creator roles. The no-lead state is not a create input; it can only happen later through matter-team vacancy handling.
What changed
Add matter
Lead counsel
Search eligible editors
Pick an editor as lead counsel
Selected state
Asha Rao - Partner
Lead
Behavior
| Requirement | Implemented proof |
|---|---|
| Lead counsel is mandatory on create. |
useAddMatterDrawerForm sets the lead error and
refuses onCreate until a lead exists.
|
| Both editor and firm administrator creators see the field. |
The field is unconditional inside AddMatterDrawer;
creation reach is still controlled by the existing admin/editor
canCreateMatter gate.
|
| Lead options are active firm editors only. |
toMatterLeadCandidates() filters the firm directory
to status = active and
role = firm_editor before mapping picker rows.
|
| Create payload carries the picked lead. |
drawerMatterCreateRequest() returns the generated
MatterCreateRequest with required
leadUserId.
|
Storybook proof
AddMatter/DrawerLeadField / DefaultAddMatter/DrawerLeadField / SelectedAddMatter/DrawerLeadField / Required ErrorAddMatter/DrawerLeadField / No Eligible EditorsMatters/AddMatterDrawer / Lead SelectedMatters/AddMatterDrawer / No Eligible Lead EditorsMatters/AddMatterDrawer / Validation
BDD proof
-
MT-01- an editor is asked to choose lead counsel. -
MT-02- a firm administrator is asked to choose lead counsel. -
MT-03- create is not submitted before lead counsel is chosen.
Verification
pnpm typecheckpnpm lint- existing warnings only-
pnpm vitest run tests/unit/to-firm-member.test.ts tests/unit/use-add-matter-drawer-form.test.tsx tests/unit/live-matters-wizard-payload.test.ts pnpm check:featurespnpm storybook:build
Files changed
23 file(s), +749 / -155 lines
| Path | Role | + | - |
|---|---|---|---|
| messages/en.json | Config | +6 | -3 |
| messages/hi.json | Config | +6 | -3 |
| src/components/add-matter/__mocks__/team-draft.ts | Component | +8 | -0 |
| src/components/add-matter/add-matter-drawer.stories.tsx | Component | +52 | -10 |
| src/components/add-matter/add-matter-drawer.tsx | Component | +24 | -11 |
| src/components/add-matter/avatar.tsx | Component | +7 | -2 |
| src/components/add-matter/drawer-client-field.tsx | Component | +3 | -3 |
| src/components/add-matter/drawer-field-bits.tsx | Component | +1 | -1 |
| src/components/add-matter/drawer-lead-field.stories.tsx | Component | +27 | -5 |
| src/components/add-matter/drawer-lead-field.tsx | Component | +36 | -20 |
| src/components/add-matter/drawer-title-field.tsx | Component | +2 | -2 |
| src/components/add-matter/drawer-type-field.tsx | Component | +4 | -4 |
| src/components/add-matter/member-combobox-lead-picker.tsx | Component | +180 | -0 |
| src/components/add-matter/member-combobox-search-picker.tsx | Component | +110 | -0 |
| src/components/add-matter/member-combobox.tsx | Component | +59 | -72 |
| src/components/add-matter/representing-side-field.tsx | Component | +4 | -4 |
| src/components/add-matter/to-firm-member.ts | Component | +18 | -0 |
| src/components/matters/add-matter-launcher.tsx | Component | +2 | -6 |
| src/components/matters/live-matter-sheet.tsx | Component | +2 | -5 |
| tests/e2e/clerk-auth.ts | Test | +7 | -3 |
| tests/features/add-matter-lead-picker.feature | Test | +24 | -0 |
| tests/steps/add-matter-lead-picker.steps.ts | Test | +108 | -0 |
| tests/unit/to-firm-member.test.ts | Test | +59 | -1 |