[architect] MemberDirectory/index.js is a god component — 476-line file mixes modal, card, hooks, and utilities
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Architecture Finding
**Type**: god-component / missing separation of concerns
**Affected area**: `src/components/MemberDirectory/index.js`
`MemberDirectory/index.js` is 476 lines and contains four distinct units in one file:
| Unit | Lines | Concern |
|---|---|---|
| `initials()`, `formatCount()` | 7–19 | Pure utilities |
| `useFilterOptions()` | 20–32 | Custom hook |
| `MemberProfile` | 35–242 | Focus-trap dialog (209 lines) |
| `MemberCard` | 243–312 | Card with inline modal trigger |
| `MemberDirectory` (default export) | 312–476 | Filter + list orchestrator |
The `MemberProfile` dialog alone is 209 lines managing scroll-lock, focus trap, keyboard navigation, and backdrop dismissal. At this size it is untestable in isolation and invisible to component discovery tools.
## Impact
- Dialog focus-trap logic cannot be unit-tested without importing the entire directory component
- Any team member editing the dialog touches the same file as filter logic, causing unrelated merge conflicts
- Future dialog reuse (e.g. for AwardsTimeline) requires copy-paste of the focus-trap pattern
## Recommendation
Split into co-located sub-modules under `src/components/MemberDirectory/`:
```
src/components/MemberDirectory/
utils.js # initials(), formatCount()
hooks.js # useFilterOptions()
MemberProfile.js # focus-trap modal
MemberCard.js # card trigger
index.js # filter + list orchestrator (thin)
```
Zero behaviour change; all exports stay identical.
---
*Filed by architect agent (ACMM L6 — full mode)*
Contributor guide
Research direction
Read src/components/MemberDirectory/index.js and map the listed utilities, hook, MemberProfile, MemberCard, and directory orchestrator before separating them into the proposed co-located modules. Verify that exports and behavior remain unchanged, including the dialog focus-trap behavior and directory filtering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100