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
3 changes: 2 additions & 1 deletion src/components/LHNOptionsList/LHNOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import type {BlockingViewProps} from '@components/BlockingViews/BlockingView';
import BlockingView from '@components/BlockingViews/BlockingView';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 13 in src/components/LHNOptionsList/LHNOptionsList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 13 in src/components/LHNOptionsList/LHNOptionsList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider';
import TextBlock from '@components/TextBlock';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
Expand Down Expand Up @@ -240,7 +240,7 @@
isReportArchived: !!itemReportNameValuePairs?.private_isArchived,
policyForMovingExpensesID,
reportMetadata: itemReportMetadata,
currentUserAccountID,
reportAttributesDerived: reportAttributes,
});

const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID;
Expand Down Expand Up @@ -268,6 +268,7 @@
reportID={reportID}
fullReport={item}
reportAttributes={itemReportAttributes}
reportAttributesDerived={reportAttributes}
oneTransactionThreadReport={itemOneTransactionThreadReport}
reportNameValuePairs={itemReportNameValuePairs}
reportActions={itemReportActions}
Expand Down
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/OptionRowLHNData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function OptionRowLHNData({
isOptionFocused = false,
fullReport,
reportAttributes,
reportAttributesDerived,
oneTransactionThreadReport,
reportNameValuePairs,
reportActions,
Expand Down Expand Up @@ -78,6 +79,7 @@ function OptionRowLHNData({
movedFromReport,
movedToReport,
currentUserAccountID,
reportAttributesDerived,
});
if (deepEqual(item, optionItemRef.current)) {
return optionItemRef.current;
Expand Down Expand Up @@ -114,6 +116,7 @@ function OptionRowLHNData({
movedFromReport,
movedToReport,
currentUserAccountID,
reportAttributesDerived,
]);

return (
Expand Down
5 changes: 4 additions & 1 deletion src/components/LHNOptionsList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
Transaction,
TransactionViolation,
} from '@src/types/onyx';
import type {ReportAttributes} from '@src/types/onyx/DerivedValues';
import type {ReportAttributes, ReportAttributesDerivedValue} from '@src/types/onyx/DerivedValues';

type OptionMode = ValueOf<typeof CONST.OPTION_MODE>;

Expand Down Expand Up @@ -134,6 +134,9 @@ type OptionRowLHNDataProps = {
/** The report attributes for the report */
reportAttributes: OnyxEntry<ReportAttributes>;

/** The derived report attributes for all reports */
reportAttributesDerived?: ReportAttributesDerivedValue['reports'];

/** Whether to show the educational tooltip for the GBR or RBR */
shouldShowRBRorGBRTooltip: boolean;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchFiltersChatsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function SearchFiltersChatsSelector({initialReportIDs, onFiltersUpdate, isScreen
createOptionFromReport({...reports?.[`${ONYXKEYS.COLLECTION.REPORT}${id}`], reportID: id}, personalDetails, currentUserAccountID, reportAttributesDerived),
);
const isReportArchived = archivedReportsIdSet.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`);
const alternateText = getAlternateText(report, {}, isReportArchived, currentUserAccountID, {});
const alternateText = getAlternateText(report, {}, isReportArchived, currentUserAccountID, {}, reportAttributesDerived);
return {...report, alternateText};
});

Expand Down
173 changes: 110 additions & 63 deletions src/hooks/useSearchSelector.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ function useSearchSelectorBase({
};
}, [areOptionsInitialized, defaultOptions, contactOptions]);
const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true});
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true});
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
const [selectedOptions, setSelectedOptions] = useState<OptionData[]>(initialSelected ?? []);
const [maxResults, setMaxResults] = useState(maxResultsPerPage);
Expand Down Expand Up @@ -212,33 +213,55 @@ function useSearchSelectorBase({
personalDetails,
});
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_MEMBER_INVITE:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
excludeLogins,
excludeFromSuggestionsOnly,
includeRecentReports,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
includeUserToInvite,
personalDetails,
});
return getValidOptions(
optionsWithContacts,
allPolicies,
draftComments,
nvpDismissedProductTraining,
loginList,
currentUserAccountID,
currentUserEmail,
{
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
excludeLogins,
excludeFromSuggestionsOnly,
includeRecentReports,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
includeUserToInvite,
personalDetails,
},
countryCode,
reportAttributesDerived?.reports,
);
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
...getValidOptionsConfig,
betas: betas ?? [],
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
includeUserToInvite,
excludeLogins,
excludeFromSuggestionsOnly,
personalDetails,
});
return getValidOptions(
optionsWithContacts,
allPolicies,
draftComments,
nvpDismissedProductTraining,
loginList,
currentUserAccountID,
currentUserEmail,
{
...getValidOptionsConfig,
betas: betas ?? [],
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
includeUserToInvite,
excludeLogins,
excludeFromSuggestionsOnly,
personalDetails,
},
countryCode,
reportAttributesDerived?.reports,
);
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_SHARE_LOG:
return getValidOptions(
optionsWithContacts,
Expand All @@ -264,46 +287,69 @@ function useSearchSelectorBase({
personalDetails,
},
countryCode,
reportAttributesDerived?.reports,
);
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_SHARE_DESTINATION:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
betas,
selectedOptions,
includeMultipleParticipantReports: true,
showChatPreviewLine: true,
forcePolicyNamePreview: true,
includeThreads: true,
includeMoneyRequests: true,
includeTasks: true,
excludeLogins,
loginsToExclude: excludeLogins,
includeOwnedWorkspaceChats: true,
includeSelfDM: true,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
maxElements: maxResults,
includeUserToInvite,
personalDetails,
});
return getValidOptions(
optionsWithContacts,
allPolicies,
draftComments,
nvpDismissedProductTraining,
loginList,
currentUserAccountID,
currentUserEmail,
{
betas,
selectedOptions,
includeMultipleParticipantReports: true,
showChatPreviewLine: true,
forcePolicyNamePreview: true,
includeThreads: true,
includeMoneyRequests: true,
includeTasks: true,
excludeLogins,
loginsToExclude: excludeLogins,
includeOwnedWorkspaceChats: true,
includeSelfDM: true,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
maxElements: maxResults,
includeUserToInvite,
personalDetails,
},
countryCode,
reportAttributesDerived?.reports,
);
case CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_ATTENDEES:
return getValidOptions(optionsWithContacts, allPolicies, draftComments, nvpDismissedProductTraining, loginList, currentUserAccountID, currentUserEmail, {
...getValidOptionsConfig,
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
excludeLogins,
excludeFromSuggestionsOnly,
loginsToExclude: excludeLogins,
includeRecentReports,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
includeUserToInvite,
includeCurrentUser,
shouldAcceptName: true,
personalDetails,
});
return getValidOptions(
optionsWithContacts,
allPolicies,
draftComments,
nvpDismissedProductTraining,
loginList,
currentUserAccountID,
currentUserEmail,
{
...getValidOptionsConfig,
betas: betas ?? [],
includeP2P: true,
includeSelectedOptions: false,
excludeLogins,
excludeFromSuggestionsOnly,
loginsToExclude: excludeLogins,
includeRecentReports,
maxElements: maxResults,
maxRecentReportElements: maxRecentReportsToShow,
searchString: computedSearchTerm,
searchInputValue: trimmedSearchInput,
includeUserToInvite,
includeCurrentUser,
shouldAcceptName: true,
personalDetails,
},
countryCode,
reportAttributesDerived?.reports,
);
default:
return getEmptyOptions();
}
Expand All @@ -329,6 +375,7 @@ function useSearchSelectorBase({
currentUserAccountID,
currentUserEmail,
personalDetails,
reportAttributesDerived?.reports,
trimmedSearchInput,
]);

Expand Down
Loading
Loading