Edit Profile
Screen where a signed-in user updates their name, photo and contact details.
Purpose
Let a signed-in user review and change their own profile information — display name, avatar, email and phone number — from a single form, and persist those changes back to their account.
Behavior
The form opens pre-filled with the current profile values. The Save button stays disabled until at least one field is changed and all changed fields are valid. Saving runs the fields through validation, uploads a new avatar if one was picked, and then writes the profile in a single request.
- Save — validates, persists, and on success shows a confirmation toast and returns to the profile screen.
- Cancel — discards changes; if there are unsaved edits, a confirmation prompt is shown first.
- Change photo — opens the system photo picker; the chosen image is cropped to a square before upload.
States
- Default — the editable form, pre-filled with existing values.
- Success — the save completed; a confirmation toast is shown and the user is returned to the read-only profile screen.
Validation rules
- Display name — required, 2–40 characters, trimmed of surrounding spaces.
- Email — must be a valid address; changing it triggers a re-verification email and the new address is marked “unverified” until confirmed.
- Phone number — optional, but if present must be a valid E.164 number.
- Validation errors are shown inline under each field, and Save stays disabled while any error is present.
Edge cases
- Save conflict — if the profile changed on another device since the form was opened, the save is rejected and the user is asked to reload the latest values.
- Avatar upload fails — the text fields are still saved; the avatar reverts to the previous image and an inline error explains that only the photo failed.
- Email already in use — surfaced as an inline error on the email field rather than a generic failure.

