Why this exists
The territory workspace remains a high-change, high-risk component at roughly 1,900 lines. It owns map provider setup, data loading, filters, route planning state, sidebars, mobile detail UI, and row rendering in one file.
Intended outcome
Split the component into focused, tested modules without changing user-visible behavior.
Scope
- Extract map provider setup and lifecycle into focused hooks/helpers.
- Extract territory data/filter state into a hook or small controller module.
- Extract field console, filter panel, pin list rows, and selected-account detail panels into separate components.
- Preserve the current polished UI and browser behavior.
Non-goals
- No route-planning feature changes.
- No map provider replacement.
- No schema, auth/RLS, provider credential, or production data changes.
Acceptance criteria
- Existing territory behavior is preserved in browser smoke tests.
npm run verify passes.
- The main workspace file is materially smaller and delegates to focused modules with clear ownership.
- Follow-up risk is documented if a full split must be staged.
Source
Created from #32 refactor triage of closed PR #1.
Why this exists
The territory workspace remains a high-change, high-risk component at roughly 1,900 lines. It owns map provider setup, data loading, filters, route planning state, sidebars, mobile detail UI, and row rendering in one file.
Intended outcome
Split the component into focused, tested modules without changing user-visible behavior.
Scope
Non-goals
Acceptance criteria
npm run verifypasses.Source
Created from #32 refactor triage of closed PR #1.