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

#37605 Do not show "member not found" when loading member list #37731

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
14 changes: 9 additions & 5 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function BaseSelectionList<TItem extends ListItem>(
onScroll,
onScrollBeginDrag,
headerMessage = '',
notFoundMessage = '',
confirmButtonText = '',
onConfirm,
headerContent,
Expand Down Expand Up @@ -380,6 +381,12 @@ function BaseSelectionList<TItem extends ListItem>(
isActive: !disableKeyboardShortcuts && isFocused,
});

const renderTopMessage = (message: string) => (
<View style={[styles.ph5, styles.pb5]}>
<Text style={[styles.textLabel, styles.colorMuted]}>{message}</Text>
</View>
);

return (
<ArrowKeyFocusManager
disabledIndexes={flattenedSections.disabledOptionsIndexes}
Expand Down Expand Up @@ -422,11 +429,8 @@ function BaseSelectionList<TItem extends ListItem>(
/>
</View>
)}
{!!headerMessage && (
<View style={[styles.ph5, styles.pb5]}>
<Text style={[styles.textLabel, styles.colorMuted]}>{headerMessage}</Text>
</View>
)}
{!!headerMessage && renderTopMessage(headerMessage)}
{!!notFoundMessage && !showLoadingPlaceholder && flattenedSections.allOptions.length === 0 && renderTopMessage(notFoundMessage)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the case when 2 messages show at the same time.
But swap these rows so not found message should be above header message.

Or hide header message when not found message shows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swapped

{!!headerContent && headerContent}
{flattenedSections.allOptions.length === 0 && showLoadingPlaceholder ? (
<OptionsListSkeletonView shouldAnimate />
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 @@ -211,6 +211,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
/** Message to display at the top of the list */
headerMessage?: string;

/** Message to display when no items found */
notFoundMessage?: string;

/** Text to display on the confirm button */
confirmButtonText?: string;

Expand Down
4 changes: 3 additions & 1 deletion src/pages/workspace/WorkspaceMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ function WorkspaceMembersPage({policyMembers, personalDetails, route, policy, se
if (isOfflineAndNoMemberDataAvailable) {
return translate('workspace.common.mustBeOnlineToViewMembers');
}
return !data.length ? translate('workspace.common.memberNotFound') : '';

return '';
};

const getHeaderContent = () => (
Expand Down Expand Up @@ -538,6 +539,7 @@ function WorkspaceMembersPage({policyMembers, personalDetails, route, policy, se
disableKeyboardShortcuts={removeMembersConfirmModalVisible}
headerMessage={getHeaderMessage()}
headerContent={getHeaderContent()}
notFoundMessage={translate('workspace.common.memberNotFound')}
onSelectRow={openMemberDetails}
onCheckboxPress={(item) => toggleUser(item.accountID)}
onSelectAll={() => toggleAllUsers(data)}
Expand Down
Loading