# Delivery Component Map

## Shared (reused, not duplicated)

| Component | Source | Usage in Delivery |
|-----------|--------|-------------------|
| Button, Input, Dialog, Drawer | `@/components/ds` | All forms and actions |
| PageHeader, StatCard, DataTable | `@/components/ds` | List pages, dashboards |
| LoadingState, ErrorState, EmptyState | `@/components/ds` | All page states |
| PermissionDeniedState | `@/src/shared/ui` | 403 / missing permission |
| AuthGuard | `@/components/AuthGuard` | Portal gate |
| Tabs, Pagination, Breadcrumbs | `@/components/ds` | Tables, driver detail |

## Delivery module components

| Component | Path | Purpose |
|-----------|------|---------|
| DeliveryPortalShell | `components/DeliveryPortalShell.tsx` | Sidebar nav, mobile drawer, dark mode |
| createPortalLayout | `components/createPortalLayout.tsx` | Auth + tenant gate |
| DeliveryListCrudPage | `components/DeliveryListCrudPage.tsx` | CRUD factory for foundation entities |
| DeliveryPhaseGate | `components/DeliveryPhaseGate.tsx` | Capability-gated future screens |
| DeliveryMapPlaceholder | `components/DeliveryMapPlaceholder.tsx` | Map-first skeleton when routing enabled |
| DeliveryBreadcrumbs | `components/DeliveryBreadcrumbs.tsx` | RTL breadcrumbs |

## Design system

| Component | Path |
|-----------|------|
| deliveryTokens | `design-system/tokens.ts` |
| DeliveryStatusChip | `design-system/DeliveryStatusChip.tsx` |
| DeliveryTablePage | `design-system/DeliveryTablePage.tsx` |
| DeliveryStatGrid | `design-system/DeliveryStatGrid.tsx` |

## Feature pages (by domain)

| Domain | Feature files |
|--------|---------------|
| Dashboards | `dashboard.tsx`, `dispatcher.tsx`, `operations.tsx`, `fleetDashboard.tsx` |
| Drivers | `drivers.tsx`, `driverDetail.tsx`, `driverAvailability.tsx`, `driverPerformance.tsx` |
| Foundation | `organizations.tsx`, `branches.tsx`, `configurations.tsx`, `settings.tsx` |
| Integrations | `externalProviders.tsx`, `routingEngines.tsx` |
| Maps | `mapView.tsx`, `routePlanner.tsx`, `routeOptimization.tsx`, `geofence.tsx`, `deliveryZones.tsx` |
| Operations (phase) | `orders.tsx`, `dispatchQueue.tsx`, `assignment.tsx`, `pickups.tsx`, … |
| Finance (phase) | `cod.tsx`, `settlements.tsx`, `payments.tsx`, `wallet.tsx`, `commissions.tsx` |
| Admin | `permissions.tsx`, `audit.tsx`, `health.tsx`, `capabilities.tsx` |

## Hooks

| Hook | File |
|------|------|
| useDeliveryCapabilities | `hooks/useDeliveryCapabilities.ts` |
| useDeliveryPermissions | `hooks/useDeliveryPermissions.ts` |
| useDeliveryLookups | `hooks/useDeliveryCapabilities.ts` (organizations + hubs) |
| useDeliveryMetrics | `hooks/useDeliveryCapabilities.ts` |

## API

| Client | Path |
|--------|------|
| deliveryApi | `services/delivery-api.ts` |
| BFF proxy | `app/api/delivery/[...path]/route.ts` |
