Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the members view of rooms and expense chats consistent with groups #47201

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6a2e4d9
Make the Room Members view of rooms and expense chats consistent with…
rayane-d Aug 11, 2024
1cf175f
Fix TS error
rayane-d Aug 11, 2024
0156850
Correct removeUser function
rayane-d Aug 11, 2024
b4673ea
Clear search value after removing room members
rayane-d Aug 13, 2024
7461654
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 13, 2024
73a339b
Fix canSelectMultiple logic
rayane-d Aug 13, 2024
19b5a38
Make the members view of rooms and expense chats consistent with groups
rayane-d Aug 19, 2024
c8a130c
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 19, 2024
352c587
Fixes after merge
rayane-d Aug 19, 2024
bc43dd5
fix lint warning
rayane-d Aug 19, 2024
197d74e
Make the members view of rooms and expense chats consistent with groups
rayane-d Aug 20, 2024
b2cef7c
Correct members list top margin
rayane-d Aug 20, 2024
133290c
Fix top margin
rayane-d Aug 21, 2024
4290ca5
Update condition for showing search input
rayane-d Aug 21, 2024
62f4615
Refactor
rayane-d Aug 21, 2024
d043e2e
Fix spacing on mobile
rayane-d Aug 21, 2024
741d1b9
Fix TS errors
rayane-d Aug 21, 2024
c6d51b5
Fix lint errors
rayane-d Aug 21, 2024
f63f900
Update condition for showing search input
rayane-d Aug 21, 2024
16363ac
Naming
rayane-d Aug 21, 2024
6c24cbe
Update shouldShowTextInput condition logic for participants and room …
rayane-d Aug 21, 2024
b866fc7
Update list header for room members page
rayane-d Aug 21, 2024
44ad06e
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 21, 2024
1a31a52
Optimize shouldShowTextInput condition
rayane-d Aug 23, 2024
5fffecc
fix shouldShowTextInput condition
rayane-d Aug 23, 2024
3d2734b
Fix shouldShowTextInput logic
rayane-d Aug 23, 2024
8194dbc
fix lint warning
rayane-d Aug 23, 2024
2049329
Merge branch 'Expensify:main' into make-room-members-view-consistent-…
rayane-d Aug 23, 2024
e1416c4
wrap updateShouldShowTextInput in a useCallback
rayane-d Aug 23, 2024
52d0e83
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 27, 2024
a26a72d
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 27, 2024
fd91360
Refactor shouldShowTextInput logic to improve performance and readabi…
rayane-d Aug 27, 2024
2e68192
make suggested changes
rayane-d Aug 28, 2024
a486c4b
Fix reat-compiler error
rayane-d Aug 28, 2024
74d2063
Fix TS errors
rayane-d Aug 28, 2024
659f1c6
refactor of shouldShowTextInput logic
rayane-d Aug 28, 2024
eecab21
clear SearchInputManager.searchInput
rayane-d Aug 28, 2024
7d03a69
keep SearchInputManager.searchInput when inviting a member
rayane-d Aug 28, 2024
c221429
reset the searchInput if the search bar is not visible
rayane-d Aug 29, 2024
a6c5c81
Make SearchInputManager.searchInput logic consistent
rayane-d Aug 30, 2024
646b24a
reset SearchInputManager.searchInput if text input becomes invisible
rayane-d Aug 31, 2024
f08860a
Merge branch 'main' into make-room-members-view-consistent-with-group…
rayane-d Aug 31, 2024
8a63825
align Member label with the left side of the avatar
rayane-d Sep 4, 2024
89b486c
remove unnecessary dep
rayane-d Sep 4, 2024
3732f43
Merge branch 'Expensify:main' into make-room-members-view-consistent-…
rayane-d Sep 4, 2024
a65aaa9
Correct comments
rayane-d Sep 8, 2024
168d3c9
Update remove member button text
rayane-d Sep 8, 2024
55fddd8
Add the table header to the page when the report is not a group chat
rayane-d Sep 8, 2024
e69a45a
prettier
rayane-d Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,9 @@ const CONST = {
EXPORT_TO_INTEGRATION: 'exportToIntegration',
MARK_AS_EXPORTED: 'markAsExported',
},
ROOM_MEMBERS_BULK_ACTION_TYPES: {
REMOVE: 'remove',
},
},
NEXT_STEP: {
ICONS: {
Expand Down Expand Up @@ -4104,6 +4107,11 @@ const CONST = {
*/
MAX_SELECTION_LIST_PAGE_LENGTH: 500,

/**
* We only include the members search bar when we have 8 or more members
*/
SHOULD_SHOW_MEMBERS_SEARCH_INPUT_BREAKPOINT: 8,

/**
* Bank account names
*/
Expand Down
4 changes: 4 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ const ROUTES = {
route: 'r/:reportID/members',
getRoute: (reportID: string) => `r/${reportID}/members` as const,
},
ROOM_MEMBER_DETAILS: {
route: 'r/:reportID/members/:accountID',
getRoute: (reportID: string, accountID: string | number) => `r/${reportID}/members/${accountID}` as const,
},
ROOM_INVITE: {
route: 'r/:reportID/invite/:role?',
getRoute: (reportID: string, role?: string) => `r/${reportID}/invite/${role ?? ''}` as const,
Expand Down
8 changes: 6 additions & 2 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const SCREENS = {
SIGN_IN: 'SignIn',
PRIVATE_NOTES: 'Private_Notes',
ROOM_MEMBERS: 'RoomMembers',
ROOM_MEMBER_DETAILS: 'RoomMembers_Details',
ROOM_INVITE: 'RoomInvite',
REFERRAL: 'Referral',
PROCESS_MONEY_REQUEST_HOLD: 'ProcessMoneyRequestHold',
Expand Down Expand Up @@ -509,8 +510,11 @@ const SCREENS = {
DETAILS: 'ReportParticipants_Details',
ROLE: 'ReportParticipants_Role',
},
ROOM_MEMBERS_ROOT: 'RoomMembers_Root',
ROOM_INVITE_ROOT: 'RoomInvite_Root',
ROOM_MEMBERS: {
ROOT: 'RoomMembers_Root',
INVITE: 'RoomMembers_Invite',
DETAILS: 'RoomMember_Details',
},
FLAG_COMMENT_ROOT: 'FlagComment_Root',
REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount',
GET_ASSISTANCE: 'GetAssistance',
Expand Down
3 changes: 3 additions & 0 deletions src/components/ButtonWithDropdownMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type PaymentType = DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE | typeof CONST.IOU.

type WorkspaceMemberBulkActionType = DeepValueOf<typeof CONST.POLICY.MEMBERS_BULK_ACTION_TYPES>;

type RoomMemberBulkActionType = DeepValueOf<typeof CONST.REPORT.ROOM_MEMBERS_BULK_ACTION_TYPES>;

type WorkspaceDistanceRatesBulkActionType = DeepValueOf<typeof CONST.POLICY.BULK_ACTION_TYPES>;

type WorkspaceTaxRatesBulkActionType = DeepValueOf<typeof CONST.POLICY.BULK_ACTION_TYPES>;
Expand Down Expand Up @@ -105,6 +107,7 @@ type ButtonWithDropdownMenuProps<TValueType> = {
export type {
PaymentType,
WorkspaceMemberBulkActionType,
RoomMemberBulkActionType,
WorkspaceDistanceRatesBulkActionType,
DropdownOption,
ButtonWithDropdownMenuProps,
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldDelayFocus = true,
shouldUpdateFocusedIndex = false,
onLongPressRow,
shouldShowTextInput = !!textInputLabel || !!textInputIconLeft,
shouldShowListEmptyContent = true,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
Expand All @@ -106,7 +107,6 @@ function BaseSelectionList<TItem extends ListItem>(
const listRef = useRef<RNSectionList<TItem, SectionWithIndexOffset<TItem>>>(null);
const innerTextInputRef = useRef<RNTextInput | null>(null);
const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const shouldShowTextInput = !!textInputLabel || !!textInputIconLeft;
const shouldShowSelectAll = !!onSelectAll;
const activeElementRole = useActiveElementRole();
const isFocused = useIsFocused();
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
/** Callback to fire when an error is dismissed */
onDismissError?: (item: TItem) => void;

/** Whether to show the text input */
shouldShowTextInput?: boolean;

/** Label for the text input */
textInputLabel?: string;

Expand Down
6 changes: 3 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,6 @@ export default {
groupName: 'Group name',
},
groupChat: {
groupMembersListTitle: 'Directory of all group members.',
lastMemberTitle: 'Heads up!',
lastMemberWarning: "Since you're the last person here, leaving will make this chat inaccessible to all users. Are you sure you want to leave?",
defaultReportName: ({displayName}: {displayName: string}) => `${displayName}'s group chat`,
Expand Down Expand Up @@ -3159,8 +3158,9 @@ export default {
removeMembersWarningPrompt: ({memberName, ownerName}: RemoveMembersWarningPrompt) =>
`${memberName} is an approver in this workspace. When you unshare this workspace with them, we’ll replace them in the approval workflow with the workspace owner, ${ownerName}`,
removeMembersTitle: 'Remove members',
removeMemberButtonTitle: 'Remove from workspace',
removeMemberGroupButtonTitle: 'Remove from group',
removeWorkspaceMemberButtonTitle: 'Remove from workspace',
removeGroupMemberButtonTitle: 'Remove from group',
removeRoomMemberButtonTitle: 'Remove from chat',
removeMemberPrompt: ({memberName}: {memberName: string}) => `Are you sure you want to remove ${memberName}?`,
removeMemberTitle: 'Remove member',
transferOwner: 'Transfer owner',
Expand Down
6 changes: 3 additions & 3 deletions src/languages/es.ts

This comment was marked as resolved.

Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,6 @@ export default {
groupName: 'Nombre del grupo',
},
groupChat: {
groupMembersListTitle: 'Directorio de los miembros del grupo.',
lastMemberTitle: '¡Atención!',
lastMemberWarning: 'Ya que eres la última persona aquí, si te vas, este chat quedará inaccesible para todos los miembros. ¿Estás seguro de que quieres salir del chat?',
defaultReportName: ({displayName}: {displayName: string}) => `Chat de grupo de ${displayName}`,
Expand Down Expand Up @@ -3210,8 +3209,9 @@ export default {
removeMembersWarningPrompt: ({memberName, ownerName}: RemoveMembersWarningPrompt) =>
`${memberName} es un aprobador en este espacio de trabajo. Cuando lo elimine de este espacio de trabajo, los sustituiremos en el flujo de trabajo de aprobación por el propietario del espacio de trabajo, ${ownerName}`,
removeMembersTitle: 'Eliminar miembros',
removeMemberButtonTitle: 'Quitar del espacio de trabajo',
removeMemberGroupButtonTitle: 'Quitar del grupo',
removeWorkspaceMemberButtonTitle: 'Eliminar del espacio de trabajo',
removeGroupMemberButtonTitle: 'Eliminar del grupo',
removeRoomMemberButtonTitle: 'Eliminar del chat',
removeMemberPrompt: ({memberName}: {memberName: string}) => `¿Estás seguro de que deseas eliminar a ${memberName}?`,
removeMemberTitle: 'Eliminar miembro',
transferOwner: 'Transferir la propiedad',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type {
ReportDescriptionNavigatorParamList,
ReportDetailsNavigatorParamList,
ReportSettingsNavigatorParamList,
RoomInviteNavigatorParamList,
RoomMembersNavigatorParamList,
SearchAdvancedFiltersParamList,
SearchReportParamList,
Expand Down Expand Up @@ -149,11 +148,9 @@ const ReportParticipantsModalStackNavigator = createModalStackNavigator<Particip
});

const RoomMembersModalStackNavigator = createModalStackNavigator<RoomMembersNavigatorParamList>({
[SCREENS.ROOM_MEMBERS_ROOT]: () => require<ReactComponentModule>('../../../../pages/RoomMembersPage').default,
});

const RoomInviteModalStackNavigator = createModalStackNavigator<RoomInviteNavigatorParamList>({
[SCREENS.ROOM_INVITE_ROOT]: () => require<ReactComponentModule>('../../../../pages/RoomInvitePage').default,
[SCREENS.ROOM_MEMBERS.ROOT]: () => require<ReactComponentModule>('../../../../pages/RoomMembersPage').default,
[SCREENS.ROOM_MEMBERS.INVITE]: () => require<ReactComponentModule>('../../../../pages/RoomInvitePage').default,
[SCREENS.ROOM_MEMBERS.DETAILS]: () => require<ReactComponentModule>('../../../../pages/RoomMemberDetailsPage').default,
});

const NewChatModalStackNavigator = createModalStackNavigator<NewChatNavigatorParamList>({
Expand Down Expand Up @@ -566,7 +563,6 @@ export {
ReportDetailsModalStackNavigator,
ReportParticipantsModalStackNavigator,
ReportSettingsModalStackNavigator,
RoomInviteModalStackNavigator,
RoomMembersModalStackNavigator,
SettingsModalStackNavigator,
SignInModalStackNavigator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ function RightModalNavigator({navigation, route}: RightModalNavigatorProps) {
name={SCREENS.RIGHT_MODAL.ROOM_MEMBERS}
component={ModalStackNavigators.RoomMembersModalStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.ROOM_INVITE}
component={ModalStackNavigators.RoomInviteModalStackNavigator}
/>
<Stack.Screen
name={SCREENS.RIGHT_MODAL.MONEY_REQUEST}
component={ModalStackNavigators.MoneyRequestModalStackNavigator}
Expand Down
9 changes: 3 additions & 6 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,14 +891,11 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.REPORT_PARTICIPANTS.ROLE]: ROUTES.REPORT_PARTICIPANTS_ROLE_SELECTION.route,
},
},
[SCREENS.RIGHT_MODAL.ROOM_INVITE]: {
screens: {
[SCREENS.ROOM_INVITE_ROOT]: ROUTES.ROOM_INVITE.route,
},
},
[SCREENS.RIGHT_MODAL.ROOM_MEMBERS]: {
screens: {
[SCREENS.ROOM_MEMBERS_ROOT]: ROUTES.ROOM_MEMBERS.route,
[SCREENS.ROOM_MEMBERS.ROOT]: ROUTES.ROOM_MEMBERS.route,
[SCREENS.ROOM_MEMBERS.INVITE]: ROUTES.ROOM_INVITE.route,
[SCREENS.ROOM_MEMBERS.DETAILS]: ROUTES.ROOM_MEMBER_DETAILS.route,
},
},
[SCREENS.RIGHT_MODAL.MONEY_REQUEST]: {
Expand Down
13 changes: 6 additions & 7 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,14 +788,15 @@ type ParticipantsNavigatorParamList = {
};

type RoomMembersNavigatorParamList = {
[SCREENS.ROOM_MEMBERS_ROOT]: undefined;
};

type RoomInviteNavigatorParamList = {
[SCREENS.ROOM_INVITE_ROOT]: {
[SCREENS.ROOM_MEMBERS.ROOT]: {reportID: string};
[SCREENS.ROOM_MEMBERS.INVITE]: {
reportID: string;
role?: 'accountant';
};
[SCREENS.ROOM_MEMBERS.DETAILS]: {
reportID: string;
accountID: string;
};
};

type MoneyRequestNavigatorParamList = {
Expand Down Expand Up @@ -1100,7 +1101,6 @@ type RightModalNavigatorParamList = {
[SCREENS.RIGHT_MODAL.REPORT_DESCRIPTION]: NavigatorScreenParams<ReportDescriptionNavigatorParamList>;
[SCREENS.RIGHT_MODAL.PARTICIPANTS]: NavigatorScreenParams<ParticipantsNavigatorParamList>;
[SCREENS.RIGHT_MODAL.ROOM_MEMBERS]: NavigatorScreenParams<RoomMembersNavigatorParamList>;
[SCREENS.RIGHT_MODAL.ROOM_INVITE]: NavigatorScreenParams<RoomInviteNavigatorParamList>;
[SCREENS.RIGHT_MODAL.MONEY_REQUEST]: NavigatorScreenParams<MoneyRequestNavigatorParamList>;
[SCREENS.RIGHT_MODAL.NEW_TASK]: NavigatorScreenParams<NewTaskNavigatorParamList>;
[SCREENS.RIGHT_MODAL.TEACHERS_UNITE]: NavigatorScreenParams<TeachersUniteNavigatorParamList>;
Expand Down Expand Up @@ -1397,7 +1397,6 @@ export type {
ReportDetailsNavigatorParamList,
ReportSettingsNavigatorParamList,
RightModalNavigatorParamList,
RoomInviteNavigatorParamList,
RoomMembersNavigatorParamList,
RootStackParamList,
SettingsNavigatorParamList,
Expand Down
16 changes: 14 additions & 2 deletions src/pages/InviteReportParticipantsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import ROUTES from '@src/ROUTES';
import type {InvitedEmailsToAccountIDs, PersonalDetailsList} from '@src/types/onyx';
import type {WithReportOrNotFoundProps} from './home/report/withReportOrNotFound';
import withReportOrNotFound from './home/report/withReportOrNotFound';
import SearchInputManager from './workspace/SearchInputManager';

type InviteReportParticipantsPageOnyxProps = {
/** All of the personal details for everyone */
Expand All @@ -48,6 +49,11 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
const [selectedOptions, setSelectedOptions] = useState<ReportUtils.OptionData[]>([]);

useEffect(() => {
setSearchTerm(SearchInputManager.searchInput);
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);

// Any existing participants and Expensify emails should not be eligible for invitation
const excludedUsers = useMemo(
() => [...PersonalDetailsUtils.getLoginsByAccountIDs(ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true)), ...CONST.EXPENSIFY_EMAILS],
Expand Down Expand Up @@ -200,7 +206,10 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen
<FormAlertWithSubmitButton
isDisabled={!selectedOptions.length}
buttonText={translate('common.invite')}
onSubmit={inviteUsers}
onSubmit={() => {
SearchInputManager.searchInput = '';
inviteUsers();
}}
containerStyles={[styles.flexReset, styles.flexGrow0, styles.flexShrink0, styles.flexBasisAuto]}
enabledWhenOffline
/>
Expand Down Expand Up @@ -228,7 +237,10 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen
ListItem={InviteMemberListItem}
textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')}
textInputValue={searchTerm}
onChangeText={setSearchTerm}
onChangeText={(value) => {
SearchInputManager.searchInput = value;
setSearchTerm(value);
}}
headerMessage={headerMessage}
onSelectRow={toggleOption}
onConfirm={inviteUsers}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReportParticipantDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function ReportParticipantDetails({personalDetails, report, route}: ReportPartic
{isCurrentUserAdmin && (
<>
<Button
text={translate('workspace.people.removeMemberGroupButtonTitle')}
text={translate('workspace.people.removeGroupMemberButtonTitle')}
onPress={() => setIsRemoveMemberConfirmModalVisible(true)}
medium
isDisabled={isSelectedMemberCurrentUser}
Expand All @@ -112,7 +112,7 @@ function ReportParticipantDetails({personalDetails, report, route}: ReportPartic
/>
<ConfirmModal
danger
title={translate('workspace.people.removeMemberGroupButtonTitle')}
title={translate('workspace.people.removeGroupMemberButtonTitle')}
isVisible={isRemoveMemberConfirmModalVisible}
onConfirm={removeUser}
onCancel={() => setIsRemoveMemberConfirmModalVisible(false)}
Expand Down
Loading
Loading