#37Event Creation Wizard
Overview
Implement a multi-step form (3 steps) for event creation, with Zod validation, conditional navigation, and persistent form values between steps.
Requirements
- Turn the provided static UI into a working multi-step wizard (3 steps).
- Only the active step should be visible.
- Persist user input when navigating Back/Next (do not clear
valueswhen going back). - Each step uses its own form and its own action (one action per step).
- Use the provided Zod schemas for validation (
Event,Location,DateAndSettings). - Use the provided
ActionState<T>type and the helpercreateStepAction<T>to manage form state, errors, and data. - Actions return
{ ok, errors, values, data? }. - Show a success message (
data-testid="success-message") when the last step is successfully submitted. - Navigation logic:
- Step 1 → Step 2 if
isOnlineis false, otherwise Step 3. - Step 2 → Step 3.
- Step 3 → Success.
- Step 1 → Step 2 if
- Show validation errors under each input with appropriate
ariaattributes anddata-testid.
Notes
- Tests expect specific
data-testidstrings for error messages and buttons; keep them unchanged. FormData.get()returnsstring | File | null; cast safely:const name = formData.get("name")?.toString() ?? ""- For checkbox:
const isOnline = formData.get("isOnline") === "on".
Tests
- renders the app title
- renders all required fields in step 1
- shows validation errors in step 1
- goes to step 2 after submitting step 1 when onlie event is false
- shows validation errors in step 2
- shows US postal code format error in step 2
- goes directly to step 3 when event is online
- goes to step 3 after completing step 2
- shows success message after completing step 3
- shows validation errors in step 3
- returns to step 1 when going back from step 3 for online events
- returns to step 2 when going back from step 3 for offline events