Edit Contact Information with Validation
The edit contact screen must provide a form-based interface for updating contact information with real-time field validation. The form must enforce required fields, validate phone number formats, and prevent saving with invalid data. Changes must be persisted to the Supabase backend via the contact edit service and immediately reflected in the contact detail screen. The form must respect the same RLS policies to prevent coordinators from editing contacts outside their chapter scope.
User Story
Acceptance Criteria
- Given I am on the contact detail screen, when I tap the edit button, then the edit contact screen opens pre-populated with the contact's current information
- Given I am editing a contact, when I clear a required field and attempt to save, then I see an inline validation error message and the save button is disabled
- Given I submit valid edits, when the save operation completes successfully, then I am returned to the contact detail screen which immediately shows the updated information
- Given I am editing a contact outside my chapter scope, when the save operation is attempted, then the RLS policy blocks the write and I see an appropriate error message
- Given I am editing a contact and close the screen without saving, when a navigation back action is triggered, then I am prompted to confirm discarding unsaved changes
Business Value
Keeping contact information current is fundamental to the peer mentor matching process. If coordinators must escalate every data change to a central admin, incorrect phone numbers and outdated assignments persist longer, leading to failed contact attempts and wasted coordination effort. Self-service editing with proper RLS guards balances operational efficiency with data security.
Components
- Edit Contact Screen ui
- Contact Edit Service service
- Contact Detail Repository data
- Contact Form Validator infrastructure
- Contact RLS Query Builder infrastructure