Role Switch Between Coordinator and Peer Mentor
Some users hold both a coordinator and a peer mentor role within an organization. The role switch widget—accessible from the hamburger menu in Settings—allows these dual-role users to toggle their active role. When a switch is triggered, the role state manager updates the active role, the role-aware bottom nav re-renders with the appropriate tabs, and the home screen transitions to the role-specific variant. The role resolution service re-validates the user's available roles from Supabase before presenting switch options, ensuring only genuinely assigned roles are selectable.
User Story
Acceptance Criteria
- Given a user holds both coordinator and peer mentor roles, When they open the role switch widget, Then both roles are listed as selectable options
- Given a user selects the peer mentor role from the switch widget, When the switch completes, Then the home screen, bottom nav, and all role-gated UI elements update to peer mentor context
- Given a user holds only one role, When they open the role switch widget, Then no switch option is shown and the widget informs them of their single role
- Given a role switch is in progress, When the user navigates away, Then the switch completes or rolls back cleanly without leaving the UI in an inconsistent state
- Given a user with accessibility needs uses the role switch widget, When it renders, Then all interactive elements have proper semantic labels and focus management is correct
Business Value
In smaller chapters, the same volunteer often acts as both peer mentor and coordinator. Requiring them to log out and back in to switch context creates friction that leads to underreporting. Seamless role switching directly addresses the organizations' top priority of minimizing registration effort.
Components
- Role Switch Widget ui
- Role Resolution Service service
- Role State Manager service
- Role Repository data
- Supabase Role Data Provider infrastructure
- Role-Based Home Screen ui
- Role-Aware Bottom Navigation ui
Dependencies
- Role-Specific Home Screen After Login critical
- Role-Aware Bottom Navigation Tabs critical