You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(escrow): decompose EscrowSigningModal into hook/lib + presentational component
📘 Description
src/components/escrow/EscrowSigningModal.tsx (682 lines) mixes several concerns in one file: the step/operation copy tables (STEP_INFO, OPERATION_FALLBACK_INFO, getStepInfo), error-code-to-copy mapping (errorCopy, stateTitle), focus-trap/Escape-key/tab-cycling dialog accessibility logic, and substantial JSX for its 5 render states (building, awaiting signature, submitting, confirmed, error).
Grown from 296 to 682 lines in the recent step-context UX work (Frontend PR #435), which was the right UX fix but didn't address the pre-existing single-file mixing of copy data, a11y logic, and rendering.
✅ Acceptance Criteria
Step/operation copy tables and mapping functions (STEP_INFO, OPERATION_FALLBACK_INFO, getStepInfo, errorCopy, stateTitle) extracted into a dedicated file (e.g. src/lib/escrow-signing-copy.ts) — pure data/functions, no JSX
The focus-trap/Escape-key/Tab-cycling modal a11y logic extracted into a reusable hook (e.g. useFocusTrapModal) — check src/components/ui/ first in case an equivalent already exists to consolidate onto, per the "no duplicate types/logic" standard
EscrowSigningModal.tsx reduced to primarily JSX composed from the extracted hook/lib
npx tsc --noEmit, npx eslint, npx vitest run, and npm run build all stay clean
No behavior/visual change — this is a structural refactor only, existing EscrowSigningModal.test.tsx must keep passing unmodified (or with only import-path updates)
Part of the Frontend Architecture & Standards Cleanup milestone, not a paid Tranche deliverable. Check other modal components (RefundModal, OpenDisputeModal, etc.) for an existing shared focus-trap hook before writing a new one — several of them implement the same open/Escape/backdrop-click pattern independently, which may itself be worth consolidating as a follow-up.
🔧 Title:
refactor(escrow): decompose EscrowSigningModal into hook/lib + presentational component
📘 Description
src/components/escrow/EscrowSigningModal.tsx(682 lines) mixes several concerns in one file: the step/operation copy tables (STEP_INFO,OPERATION_FALLBACK_INFO,getStepInfo), error-code-to-copy mapping (errorCopy,stateTitle), focus-trap/Escape-key/tab-cycling dialog accessibility logic, and substantial JSX for its 5 render states (building, awaiting signature, submitting, confirmed, error).Grown from 296 to 682 lines in the recent step-context UX work (Frontend PR #435), which was the right UX fix but didn't address the pre-existing single-file mixing of copy data, a11y logic, and rendering.
✅ Acceptance Criteria
STEP_INFO,OPERATION_FALLBACK_INFO,getStepInfo,errorCopy,stateTitle) extracted into a dedicated file (e.g.src/lib/escrow-signing-copy.ts) — pure data/functions, no JSXuseFocusTrapModal) — checksrc/components/ui/first in case an equivalent already exists to consolidate onto, per the "no duplicate types/logic" standardEscrowSigningModal.tsxreduced to primarily JSX composed from the extracted hook/libnpx tsc --noEmit,npx eslint,npx vitest run, andnpm run buildall stay cleanEscrowSigningModal.test.tsxmust keep passing unmodified (or with only import-path updates)🔧 Context AI
docs/standards.md§Single-Responsibility Components📋 Additional Notes
Part of the Frontend Architecture & Standards Cleanup milestone, not a paid Tranche deliverable. Check other modal components (
RefundModal,OpenDisputeModal, etc.) for an existing shared focus-trap hook before writing a new one — several of them implement the same open/Escape/backdrop-click pattern independently, which may itself be worth consolidating as a follow-up.