---
fragment_id: oscar.map.documents-view.002
domain: MAP
rule: Documents view — saved exports index with re-download
source: app/src/views/Documents.tsx
bound_to_modules:
  - oscar.map
status: SHIPPED
version: .002
---

# Documents view (per codex.md §C8 + C6 user sim 20 + rules.md §11)

The Documents view is a top-level route (`/documents` or accessed via the dock). It lists every `Document` record from the `documents` IDB store, newest first.

## Row layout

Each document row shows:

- **Type icon** — one of: PDF, PNG, SVG, GeoJSON, KML, Print
- **Filename** — the original filename at export time
- **Type label** — "PDF report", "PNG image", "GeoJSON export", etc.
- **Layer count + names** — "3 layers: NW boundary hedge, T1 boundary, Site polygon"
- **Timestamp** — generated-at, formatted human-readable
- **Layer versions map** — collapsed by default; expanded shows `layerId → version` for each included layer
- **Re-download button** — regenerates the same file with the same content and triggers a download. Does NOT regenerate against current layer state — the file content is the historical snapshot per rules.md §11.

## Empty state

When no documents exist, the view shows: "No exports yet. Generate one from the Map view." with a button linking to `/map`.

## Document record shape

```
Document {
  id: string
  type: 'pdf' | 'png' | 'svg' | 'geojson' | 'kml' | 'print'
  filename: string
  layerIds: string[]
  layerVersions: Record<layerId, versionNumber>
  reportType?: 'site-visit' | 'client' | 'planning' | 'expert-witness'
  generatedAt: ISO8601
  generatedBy: 'operator'
  syncState: 'local'  (forward-compat, see oscar.map.cloud-sync-stub.002)
  syncedAt: null      (forward-compat)
  serverVersion: null (forward-compat)
}
```

The document content (the actual file bytes) is NOT stored in the IDB record in v0.2.0 — only the metadata. Re-download regenerates the file from the snapshot metadata + the layer records currently in the store, using the `layerVersions` map to determine which version of each layer to use. If a layer has been deleted since export, the re-download falls back to the most recent available version with a warning indicator in the UI.

Note: for true snapshot preservation across layer deletion, a future doctrine pass will add the file bytes to the Document record (or a sidecar blob store). v0.2.0 documents this as a known limitation.