Skip to content

Refactor territory workspace into focused map/data/detail modules #238

Description

@brycejohnson1417

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumUseful but not urgenttype:taskBounded maintenance docs CI or operational work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions