Add a Note to a Contact Record
The Contact Notes Widget provides inline add-note functionality accessible from the contact detail screen. When a note is submitted, it is stored via the Contact Notes Repository with the author's user ID and a UTC timestamp. RLS policies on Supabase restrict note creation and visibility to authorised roles within the same organisation. Notes support free-text input and are designed for brief, structured capture — for example, recording health status, assistive device situation, course interest, or next steps after a home visit (as required by Blindeforbundet's formalised report structure). The note body must be HTML-escaped before persistence and rendering. The add-note form uses the same AppTextField component as the edit screen for consistent UX.
User Story
Acceptance Criteria
- Given a user taps the add-note button on a contact detail screen, when the note input form appears, then it is focussed and ready for input without requiring additional taps
- Given a user submits a non-empty note, when the Contact Notes Repository saves it, then the note appears immediately at the top of the notes timeline with the correct author name and current timestamp
- Given a user submits an empty note, when they tap save, then submission is blocked and an inline error message is shown
- Given the app is offline when a note is submitted, when connectivity is restored, then the note is synchronised to Supabase and any conflict is resolved using last-write-wins per record
- Given a peer mentor adds a note on a contact belonging to a different organisation, when the save is attempted, then the RLS policy rejects the operation and an error is displayed
- Given a note contains HTML special characters (< > & " '), when it is stored and rendered, then all characters are escaped and displayed as plain text without executing as markup
Business Value
Contact notes are the primary mechanism for continuity of care across volunteer handoffs. Without a structured note system, organisations rely on informal memory, phone calls between mentors, and paper notes — all of which are lost when a volunteer leaves. For Blindeforbundet specifically, a formalised post-visit report structure (health status, course interest, assistive device situation, next steps) is operationally required. The notes system also creates an auditable interaction record that directly supports Bufdir grant reporting by providing evidence of peer support activity quality.
Components
- Contact Notes Widget ui
- Contact Notes Repository data
- Contact Management Service service