Add branching intake wizard (derived steps + radio-group atom)
A second wizard demonstrating a BRANCHING flow: the visible steps are derived from the answers by a pure `visibleSteps` function rather than stored, so answering "buiten Nederland gewerkt? -> ja" or reporting few hours adds steps and the progress denominator changes live. Same Elm-style store + RemoteData patterns as the fixed wizard; answers persist to localStorage. - intake.machine.ts: IntakeState union + Answers + visibleSteps + pure reduce (+spec) - intake-wizard organism, intake.page, submit-intake command - new radio-group atom (ControlValueAccessor) in shared/ui - /intake route + dashboard link + concepts showcase section - tighten Aantekening.type to a 'Specialisme' | 'Aantekening' union - README + ARCHITECTURE updated Verified live end-to-end (branches add steps 4->5->6, review, submit) with no console errors; build, unit tests, and Storybook all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
14
src/app/herregistratie/application/submit-intake.ts
Normal file
14
src/app/herregistratie/application/submit-intake.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Result, ok, err } from '@shared/kernel/fp';
|
||||
import { ValidIntake } from '../domain/intake.machine';
|
||||
|
||||
/**
|
||||
* Command: send the intake questionnaire to the backend. Returns a Result so the
|
||||
* caller branches on success/failure without try/catch. ponytail: faked with a
|
||||
* timer; swap for a real POST when there's an API. The "uren must be > 0" rule
|
||||
* lets the demo show the failure path.
|
||||
*/
|
||||
export async function submitIntake(data: ValidIntake): Promise<Result<string, void>> {
|
||||
await new Promise((r) => setTimeout(r, 800));
|
||||
if (data.uren === 0) return err('Aanvraag afgewezen: geen gewerkte uren geregistreerd.');
|
||||
return ok(undefined);
|
||||
}
|
||||
Reference in New Issue
Block a user