Mijn aanvragen (F2): document preview/download on completed uploads
Re-opening a Concept wizard now lets the user preview/download what they already uploaded (PRD 0001 goal 2). - document-chip: optional previewUrl input → a "Voorbeeld / Download" link (opens the stored bytes; server serves inline for pdf/image, attachment otherwise). - previewUrlFor callback threaded document-upload → document-category → single-upload (which builds the URL from a completed upload's documentId). Keeps URL-building out of the presentational atoms. - registratie + herregistratie wizards supply previewUrlFor via UploadAdapter.contentUrl, returning undefined for dev-simulation `demo-*` ids (no stored bytes → no link). - Story: DocumentChip/WithPreview. Gates green: vitest 128, lint, ng build, check:tokens; backend dotnet 56. (build-storybook has a pre-existing Compodoc/$localize issue in untouched files.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { WizardState, WizardMsg, Draft, initial, reduce, hasProgress } from '@he
|
||||
import { createDraftSync } from '@registratie/application/draft-sync';
|
||||
import { DocumentUploadComponent } from '@shared/ui/upload/document-upload/document-upload.component';
|
||||
import { createUploadController } from '@shared/upload/upload-controller';
|
||||
import { UploadAdapter } from '@shared/upload/upload.adapter';
|
||||
import { UploadState, initialUpload, deliveryRefs } from '@shared/upload/upload.machine';
|
||||
|
||||
/** Organism: multi-step herregistratie wizard. ALL state lives in one signal
|
||||
@@ -57,6 +58,7 @@ import { UploadState, initialUpload, deliveryRefs } from '@shared/upload/upload.
|
||||
@case (3) {
|
||||
<app-document-upload
|
||||
[state]="upload()"
|
||||
[previewUrlFor]="previewUrlFor"
|
||||
(fileSelected)="uploadCtl.onFileSelected($event.categoryId, $event.files)"
|
||||
(removeUpload)="uploadCtl.onRemove($event)"
|
||||
(retryUpload)="uploadCtl.onRetry($event)"
|
||||
@@ -76,8 +78,14 @@ import { UploadState, initialUpload, deliveryRefs } from '@shared/upload/upload.
|
||||
})
|
||||
export class HerregistratieWizardComponent {
|
||||
private profile = inject(BigProfileStore);
|
||||
private uploadAdapter = inject(UploadAdapter);
|
||||
private store = createStore<WizardState, WizardMsg>(initial, reduce);
|
||||
|
||||
/** Preview/download link for a completed upload; dev-simulation `demo-*` ids have
|
||||
no stored bytes, so they get no link. */
|
||||
protected previewUrlFor = (documentId: string): string | undefined =>
|
||||
documentId.startsWith('demo-') ? undefined : this.uploadAdapter.contentUrl(documentId);
|
||||
|
||||
/** Optional seed so Storybook / the showcase can mount any state directly. */
|
||||
seed = input<WizardState>(initial);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user