[lib] introduce useMembersGroupedByRole
Summary:
Our new chat member list sidebar organizes the list of members in a chat by their role. This diff introduces a new hook that give a threadInfo will group all the members of that thread by their role and return an array of grouped role infos.
Thankfully rohan created useRolesFromCommunityThreadInfo which handles all the heavy lifting of figuring out the role info for each member in a thread. We can use that to group our members by their role, then sort the roles alphabetically by their role name and return them as an array of GroupedRoleInfos to be consumed later.
Linear task: https://linear.app/comm/issue/ENG-5977/group-each-member-in-the-community-by-role
Depends on D10978
Test Plan:
Confirmed that the roles + members for threads matched exaclty the same values that we had in our old thread members modal
Community parent channel:
Old members list modal:
New member list sidebar:
Community sub-channel:
Old members list modal:
New member list sidebar:
Community sidebar:
Old members list modal:
New member list sidebar:
GENESIS Chat:
Old members list modal:
New member list sidebar:
Reviewers: atul, inka
Reviewed By: atul
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D10919