Skip to content
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
6 changes: 6 additions & 0 deletions src/components/SelectionList/BaseSelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function BaseSelectionList<TItem extends ListItem>(
shouldUseDefaultRightHandSideCheckmark,
selectedItems = [],
isSelected,
canShowProductTrainingTooltip,
}: SelectionListProps<TItem>,
ref: ForwardedRef<SelectionListHandle>,
) {
Expand Down Expand Up @@ -190,6 +191,10 @@ function BaseSelectionList<TItem extends ListItem>(
[isSelected, selectedItems, canSelectMultiple],
);

const canShowProductTrainingTooltipMemo = useMemo(() => {
return canShowProductTrainingTooltip && isFocused;
}, [canShowProductTrainingTooltip, isFocused]);

/**
* Iterates through the sections and items inside each section, and builds 4 arrays along the way:
* - `allOptions`: Contains all the items in the list, flattened, regardless of section
Expand Down Expand Up @@ -618,6 +623,7 @@ function BaseSelectionList<TItem extends ListItem>(
titleStyles={listItemTitleStyles}
singleExecution={singleExecution}
titleContainerStyles={listItemTitleContainerStyles}
canShowProductTrainingTooltip={canShowProductTrainingTooltipMemo}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {isTransactionGroupListItemType} from '@libs/SearchUIUtils';
import type {BaseListItemProps, ExtendedTargetedEvent, ListItem, SelectionListProps} from './types';

type BaseSelectionListItemRendererProps<TItem extends ListItem> = Omit<BaseListItemProps<TItem>, 'onSelectRow'> &
Pick<SelectionListProps<TItem>, 'ListItem' | 'shouldIgnoreFocus' | 'shouldSingleExecuteRowSelect'> & {
Pick<SelectionListProps<TItem>, 'ListItem' | 'shouldIgnoreFocus' | 'shouldSingleExecuteRowSelect' | 'canShowProductTrainingTooltip'> & {
index: number;
selectRow: (item: TItem, indexToFocus?: number) => void;
setFocusedIndex: ReturnType<typeof useArrowKeyFocusManager>[1];
Expand Down Expand Up @@ -44,6 +44,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
singleExecution,
titleContainerStyles,
shouldUseDefaultRightHandSideCheckmark,
canShowProductTrainingTooltip = true,
}: BaseSelectionListItemRendererProps<TItem>) {
const handleOnCheckboxPress = () => {
if (isTransactionGroupListItemType(item)) {
Expand Down Expand Up @@ -94,6 +95,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
titleStyles={titleStyles}
titleContainerStyles={titleContainerStyles}
shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark}
canShowProductTrainingTooltip={canShowProductTrainingTooltip}
/>
{item.footerContent && item.footerContent}
</>
Expand Down
8 changes: 7 additions & 1 deletion src/components/SelectionList/InviteMemberListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,21 @@ function InviteMemberListItem<TItem extends ListItem>({
onFocus,
shouldSyncFocus,
wrapperStyle,
canShowProductTrainingTooltip = true,
}: InviteMemberListItemProps<TItem>) {
const styles = useThemeStyles();
const theme = useTheme();
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const {isBetaEnabled} = usePermissions();

const {renderProductTrainingTooltip, shouldShowProductTrainingTooltip} = useProductTrainingContext(
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER,
!getIsUserSubmittedExpenseOrScannedReceipt() && isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) && isSelectedManagerMcTest(item.login) && !item.isSelected,
canShowProductTrainingTooltip &&
!getIsUserSubmittedExpenseOrScannedReceipt() &&
isBetaEnabled(CONST.BETAS.NEWDOT_MANAGER_MCTEST) &&
isSelectedManagerMcTest(item.login) &&
!item.isSelected,
);

const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
Expand Down
11 changes: 10 additions & 1 deletion src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ type ListItem<K extends string | number = string> = {

/** Boolean whether to display the right icon */
shouldShowRightIcon?: boolean;

/** Whether product training tooltips can be displayed */
canShowProductTrainingTooltip?: boolean;
};

type TransactionListItemType = ListItem &
Expand Down Expand Up @@ -433,7 +436,10 @@ type SplitListItemProps<TItem extends ListItem> = ListItemProps<TItem>;

type TransactionSelectionListItem<TItem extends ListItem> = ListItemProps<TItem> & Transaction;

type InviteMemberListItemProps<TItem extends ListItem> = UserListItemProps<TItem>;
type InviteMemberListItemProps<TItem extends ListItem> = UserListItemProps<TItem> & {
/** Whether product training tooltips can be displayed */
canShowProductTrainingTooltip?: boolean;
};

type UserSelectionListItemProps<TItem extends ListItem> = UserListItemProps<TItem>;

Expand Down Expand Up @@ -810,6 +816,9 @@ type SelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Whether to show the default right hand side checkmark */
shouldUseDefaultRightHandSideCheckmark?: boolean;

/** Whether product training tooltips can be displayed */
canShowProductTrainingTooltip?: boolean;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down
1 change: 1 addition & 0 deletions src/pages/Share/ShareRootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function ShareRootPage() {
<OnyxTabNavigator
id={CONST.TAB.SHARE.NAVIGATOR_ID}
tabBar={TabSelector}
lazyLoadEnabled
onTabSelect={onTabSelectFocusHandler}
>
<TopTab.Screen name={CONST.TAB.SHARE.SHARE}>{() => <ShareTab ref={shareTabInputRef} />}</TopTab.Screen>
Expand Down
6 changes: 4 additions & 2 deletions src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function MoneyRequestParticipantsSelector(
const isCategorizeOrShareAction = [CONST.IOU.ACTION.CATEGORIZE, CONST.IOU.ACTION.SHARE].some((option) => option === action);
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
const hasBeenAddedToNudgeMigration = !!tryNewDot?.nudgeMigration?.timestamp;
const canShowManagerMcTest = useMemo(() => !hasBeenAddedToNudgeMigration && action !== CONST.IOU.ACTION.SUBMIT, [hasBeenAddedToNudgeMigration, action]);

const importAndSaveContacts = useCallback(() => {
contactImport().then(({contactList, permissionStatus}: ContactImportResult) => {
Expand Down Expand Up @@ -191,7 +192,7 @@ function MoneyRequestParticipantsSelector(
shouldSeparateSelfDMChat: iouType !== CONST.IOU.TYPE.INVOICE,
shouldSeparateWorkspaceChat: true,
includeSelfDM: !isMovingTransactionFromTrackExpense(action) && iouType !== CONST.IOU.TYPE.INVOICE,
canShowManagerMcTest: !hasBeenAddedToNudgeMigration && action !== CONST.IOU.ACTION.SUBMIT,
canShowManagerMcTest,
isPerDiemRequest,
showRBR: false,
},
Expand All @@ -215,7 +216,7 @@ function MoneyRequestParticipantsSelector(
options.reports,
participants,
isPerDiemRequest,
hasBeenAddedToNudgeMigration,
canShowManagerMcTest,
]);

const chatOptions = useMemo(() => {
Expand Down Expand Up @@ -615,6 +616,7 @@ function MoneyRequestParticipantsSelector(
shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
onSelectRow={onSelectRow}
shouldSingleExecuteRowSelect
canShowProductTrainingTooltip={canShowManagerMcTest}
headerContent={
<ImportContactButton
showImportContacts={showImportContacts}
Expand Down
Loading