Skip to content

Commit

Permalink
Merge pull request #50541 from truph01/fix/49575
Browse files Browse the repository at this point in the history
fix: The selected approver has no background color
  • Loading branch information
carlosmiceli authored Oct 21, 2024
2 parents 36a8b13 + 0329637 commit b176976
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
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

0 comments on commit b176976

Please sign in to comment.