Media: eis ML-17 (kiezen of uploaden) in requirements, ontwerp en aannamelijst; pure ImagePicker-component
Continuous Integration / config-sls (pull_request) Successful in 9s
Continuous Integration / config-asf (pull_request) Successful in 5s
Continuous Integration / changes (pull_request) Canceled after 2m2s
Continuous Integration / backend-build (pull_request) Canceled after 0s
Continuous Integration / compile-sites (pull_request) Canceled after 0s
Continuous Integration / backend-test (pull_request) Canceled after 0s
Continuous Integration / vulnerability-scan (pull_request) Canceled after 0s
Continuous Integration / frontend-prepare (pull_request) Canceled after 0s
Continuous Integration / frontend-build (pull_request) Canceled after 0s
Continuous Integration / frontend-test (pull_request) Canceled after 0s
Continuous Integration / frontend-lint (pull_request) Canceled after 0s
Continuous Integration / publish-sls-test (pull_request) Canceled after 0s
Continuous Integration / publish-sls-production (pull_request) Canceled after 0s
Continuous Integration / deploy-sls-test (pull_request) Canceled after 0s
Continuous Integration / deploy-sls-production (pull_request) Canceled after 0s
Continuous Integration / publish-asf-test (pull_request) Canceled after 0s
Continuous Integration / deploy-asf-test (pull_request) Canceled after 0s
Continuous Integration / smoke-sls-test (pull_request) Canceled after 0s
Continuous Integration / smoke-asf-test (pull_request) Canceled after 0s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:24:53 +01:00
co-authored by Claude Sonnet 5.5
parent 1e89d8f3d7
commit 58f1878604
8 changed files with 278 additions and 2 deletions
@@ -185,3 +185,34 @@ The model and services live in **Core** (`SlpModularCms.Core.Media`, next to the
- Hero provider: uses per slide, detach.
- Regression: golden files and the host-injection tests unchanged; a set made before the library is still served.
- Frontend: selection by mouse and keyboard, announcements, dialog flow, i18n nl and en.
## 10. Choose or upload (ML-17)
```mermaid
flowchart LR
M[Module screen, for example a hero slide] --> P[ImagePicker]
P -->|choose| L[Library photos]
P -->|upload on the spot| U[Module upload callback]
U --> S[Upload service: guard, limits, store]
S --> R[Background renderer]
S --> L
L --> P
classDef m fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
classDef c fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
classDef s fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
class M m;
class P,L c;
class U,S,R s;
```
Text alternative: a module screen uses the picker, which either chooses a library photo or uploads through the module's upload callback; the upload service validates and stores, the renderer cuts variants in the background, and the new photo is in the library and is chosen at once.
- **Component**: `features/media/components/ImagePicker` (frontend, built as a pure component, not wired anywhere yet). Props: the library photos, the chosen id, `onChange`, an optional `onUpload(file) => Promise<photo>`, the upload limit and a short limits text. It is a radio group of thumbnails (arrow keys), plus an upload button; after a successful upload it chooses the new photo. It holds no data and calls nothing by itself, so each module decides what an upload does.
- **Same checks as the Hero**: the quick client checks are one shared function (`validateUpload`: an image, not over the limit); the host repeats and extends them (signature, pixel limit, rate limit, total storage) through the one `IMediaUploadGuard`. A multi-file upload and drag and drop stay module screens' choice (Hero keeps its own).
- **Background processing**: unchanged. An upload stores the original and returns at once; `HeroRenderService` (later a shared renderer) cuts variants. The picker shows a photo without a thumbnail ("no preview") until its set exists, and the library list refreshes while photos are processing.
- **How the Hero upload relates to the library**:
- Now (phase A): the Hero keeps its own upload (`POST /hero/images`) and its `HeroImages` table. Hero photos already appear in the library through the usage provider, so a photo uploaded in the Hero is visible and clean-up-able in the library. The Hero screen does not use the picker yet, and no behaviour changes.
- Phase B: one upload service in Core; **every upload creates exactly one library record** (`MediaAsset`), whichever module's screen it came from; the same file is one record (hash). The Hero's slide then refers to the library photo instead of its own image row.
- Phase C: the existing `HeroImages` are copied as library records with the same ids, hashes and set hashes (design section 6), after which the Hero screen switches to the picker.
- **Other modules** (gallery, mosaic, masonry) use the picker from the start, with their own use definition (`GalleryUses`) deciding the ratios and crops of the chosen photo.
- **Rights and limits**: the same Owner and Administrator rights as the library; the hero upload rate limit (100 per user per hour) applies to the shared upload service.