Add spec, plan, and tasks for 030-bulk-import-sources feature

Defines the "Bulk Import All Sources" feature for the on-demand bestiary
system: one-click loading of all ~104 bestiary sources with concurrent
fetching, progress feedback, toast notifications, and completion reporting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-10 22:45:37 +01:00
parent 91120d7c82
commit c323adc343
8 changed files with 559 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
# Data Model: Bulk Import All Sources
## Entities
### BulkImportState
Tracks the progress and outcome of a bulk import operation.
| Field | Type | Description |
|-------|------|-------------|
| status | "idle" / "loading" / "complete" / "partial-failure" | Current phase of the import operation |
| total | number | Total number of sources to fetch (excludes already-cached) |
| completed | number | Number of sources successfully fetched and cached |
| failed | number | Number of sources that failed to fetch |
**State Transitions**:
- `idle``loading`: User clicks "Load All"
- `loading``complete`: All sources fetched successfully (failed === 0)
- `loading``partial-failure`: Some sources failed (failed > 0)
- `complete` / `partial-failure``idle`: User dismisses or starts a new import
### ToastNotification
Lightweight notification data for the toast component.
| Field | Type | Description |
|-------|------|-------------|
| message | string | Primary text to display (e.g., "Loading sources... 34/102") |
| progress | number (0-1) or undefined | Optional progress bar value |
| dismissible | boolean | Whether the toast shows a dismiss button |
| autoDismissMs | number or undefined | Auto-dismiss delay in ms; undefined means persistent |
## Relationships
- **BulkImportState** drives the content of both the side panel progress UI and the toast notification.
- **ToastNotification** is derived from BulkImportState when the side panel is closed during an active import.
- Both consume state from the `useBulkImport` hook.
## Existing Entities (unchanged)
- **CachedSourceRecord** (bestiary-cache.ts): Stores normalized creature data per source in IndexedDB. No schema changes.
- **BestiaryIndex** (domain): Read-only index with source codes and compact creature entries. No changes.