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

fix: The selected approver has no background color #50541

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldIgnoreFocus = false,
scrollEventThrottle,
contentContainerStyle,
shouldHighlightSelectedItem = false,
}: BaseSelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -476,6 +477,7 @@ function BaseSelectionList<TItem extends ListItem>(
setFocusedIndex(normalizedIndex);
}}
shouldSyncFocus={!isTextInputFocusedRef.current}
shouldHighlightSelectedItem={shouldHighlightSelectedItem}
wrapperStyle={listItemWrapperStyle}
/>
{item.footerContent && item.footerContent}
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/InviteMemberListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function InviteMemberListItem<TItem extends ListItem>({
rightHandSideComponent,
onFocus,
shouldSyncFocus,
shouldHighlightSelectedItem,
}: InviteMemberListItemProps<TItem>) {
const styles = useThemeStyles();
const theme = useTheme();
Expand All @@ -58,6 +59,7 @@ function InviteMemberListItem<TItem extends ListItem>({

return (
<BaseListItem
pressableStyle={[[shouldHighlightSelectedItem && item.isSelected && styles.activeComponentBG]]}
item={item}
wrapperStyle={[styles.flex1, styles.justifyContentBetween, styles.sidebarLinkInner, styles.userSelectNone, styles.peopleRow, isFocused && styles.sidebarLinkActive]}
isFocused={isFocused}
Expand Down
6 changes: 6 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ type ListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {

/** Whether to show RBR */
shouldDisplayRBR?: boolean;

/** Whether we highlight all the selected items */
shouldHighlightSelectedItem?: boolean;
};

type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
Expand Down Expand Up @@ -584,6 +587,9 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Additional styles to apply to scrollable content */
contentContainerStyle?: StyleProp<ViewStyle>;

/** Whether we highlight all the selected items */
shouldHighlightSelectedItem?: boolean;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ function WorkspaceWorkflowsApprovalsApproverPage({policy, personalDetails, isLoa
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
const [approvalWorkflow] = useOnyx(ONYXKEYS.APPROVAL_WORKFLOW);
const [selectedApproverEmail, setSelectedApproverEmail] = useState<string | undefined>(undefined);
const [allApprovers, setAllApprovers] = useState<SelectionListApprover[]>([]);
const shouldShowTextInput = allApprovers?.length >= 8;

// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundView = (isEmptyObject(policy) && !isLoadingReportData) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy);
Expand Down Expand Up @@ -115,6 +117,7 @@ function WorkspaceWorkflowsApprovalsApproverPage({policy, personalDetails, isLoa
.filter((approver): approver is SelectionListApprover => !!approver);

approvers.push(...availableApprovers);
setAllApprovers(approvers);
}

const filteredApprovers =
Expand Down Expand Up @@ -255,6 +258,8 @@ function WorkspaceWorkflowsApprovalsApproverPage({policy, personalDetails, isLoa
footerContent={button}
listEmptyContent={listEmptyContent}
shouldShowListEmptyContent={shouldShowListEmptyContent}
shouldHighlightSelectedItem
shouldShowTextInput={shouldShowTextInput}
/>
</FullPageNotFoundView>
</ScreenWrapper>
Expand Down
Loading