# CRM Component Map

**Date:** 2026-07-26

## Module components (`modules/crm/`)

| Component | Path | Purpose |
|-----------|------|---------|
| `CrmPortalShell` | `components/CrmPortalShell.tsx` | Sidebar nav, mobile drawer, theme toggle |
| `createPortalLayout` | `components/createPortalLayout.tsx` | AuthGuard + tenant gate + shell |
| `CrmBreadcrumbs` | `components/CrmBreadcrumbs.tsx` | CRM-root breadcrumbs |
| `CrmScopeNotice` | `components/CrmScopeNotice.tsx` | Out-of-scope feature messaging |
| `CrmListCrudPage` / `createCrmListPage` | `components/CrmListCrudPage.tsx` | Generic list CRUD factory |
| `CrmTablePage` | `design-system/CrmTablePage.tsx` | Search, sort, pagination, bulk bar |
| `CrmStatGrid` | `design-system/CrmTablePage.tsx` | Dashboard stat cards |
| `CrmStatusChip` | `design-system/CrmStatusChip.tsx` | Domain status badges |

## Shared platform (`@/components/ds`)

Used across all CRM pages:

- `PageHeader`, `DataTable`, `EmptyState`, `LoadingState`, `ErrorState`
- `Button`, `Input`, `Textarea`, `Select`, `FormField`, `Checkbox`
- `Dialog`, `Drawer`, `ConfirmDialog`
- `Card`, `Badge`, `Pagination`, `Skeleton`, `Breadcrumbs`

## Feature pages (`modules/crm/features/sales/`)

| File | Default export / named | Entities |
|------|------------------------|----------|
| `dashboards.tsx` | 6 dashboard exports | Aggregates |
| `leads.tsx` | default | Lead CRUD |
| `contacts.tsx` | default | Contact CRUD |
| `companies.tsx` | default | Organization CRUD |
| `customers.tsx` | default | Combined view |
| `deals.tsx` | default | Opportunity CRUD + win/lose |
| `kanban.tsx` | default | Pipeline board |
| `pipelines.tsx` | default | Pipeline CRUD |
| `quotes.tsx` | default | Quote CRUD |
| `activities.tsx` | default | SalesActivity CRUD |
| `tasks.tsx` | default | Task create + complete |
| `meetings.tsx` | default | Meeting create |
| `calls.tsx` | default | CallLog create |
| `emails.tsx` | default | Email metadata create |
| `notes.tsx` | default | Note per entity |
| `timeline.tsx` | default | Timeline list |
| `documents.tsx` | default | Attachment refs |
| `tags.tsx` | default | Tag CRUD |
| `custom-fields.tsx` | default | CustomField CRUD |
| `export.tsx` | default | CSV export |
| `reports.tsx` | default | Client reports |
| `analytics.tsx` | default | Analytics dashboard |
| `scoped.tsx` | Campaigns, Segments, Import, Automation, Integrations, ApiKeys | Scope notices |
| `admin.tsx` | Notifications, Roles, Permissions, Audit, Settings, Health, Capabilities | Admin |

## Services & hooks

| Symbol | Path |
|--------|------|
| `crmApi` | `services/crm-api.ts` |
| `useCrmKeyboardShortcuts` | `hooks/useCrmKeyboardShortcuts.ts` |
| `useCrmHealth`, `useCrmCounts` | `pages/shared.tsx` |

## Query key namespace

Prefix: `["crm", tenantId, ...]`

Examples: `leads`, `opportunities`, `mentions-unread`, `counts`
