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: 0 additions & 3 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6661,7 +6661,6 @@ const CONST = {
CATEGORY: 'category',
TAG: 'tag',
TOTAL_AMOUNT: 'amount',
TOTAL: 'total',
TYPE: 'type',
ACTION: 'action',
TAX_AMOUNT: 'taxAmount',
Expand All @@ -6671,8 +6670,6 @@ const CONST = {
COMMENTS: 'comments',
CARD: 'card',
WITHDRAWAL_ID: 'withdrawalID',
AVATAR: 'avatar',
STATUS: 'status',
},
SYNTAX_OPERATORS: {
AND: 'and',
Expand Down
25 changes: 3 additions & 22 deletions src/components/Search/SearchPageHeader/SearchFiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,6 @@ function SearchFiltersBar({
return [options, value];
}, [allPolicies, email, unsafeType]);

const isExpenseReportType = useMemo(() => type?.value === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT, [type]);

const selectedItemsCount = useMemo(() => {
if (!selectedTransactions) {
return 0;
}

if (isExpenseReportType) {
// In expense report mode, count unique reports instead of individual transactions
const reportIDs = new Set(
Object.values(selectedTransactions)
.map((transaction) => transaction?.reportID)
.filter((reportID): reportID is string => !!reportID),
);
return reportIDs.size;
}

// Otherwise count transactions
return selectedTransactionsKeys.length;
}, [selectedTransactions, isExpenseReportType, selectedTransactionsKeys.length]);

const [groupByOptions, groupBy] = useMemo(() => {
const options = getGroupByOptions();
const value = options.find((option) => option.value === unsafeGroupBy) ?? null;
Expand Down Expand Up @@ -683,7 +662,9 @@ function SearchFiltersBar({
return <SearchFiltersSkeleton shouldAnimate />;
}

const selectionButtonText = areAllMatchingItemsSelected ? translate('search.exportAll.allMatchingItemsSelected') : translate('workspace.common.selected', {count: selectedItemsCount});
const selectionButtonText = areAllMatchingItemsSelected
? translate('search.exportAll.allMatchingItemsSelected')
: translate('workspace.common.selected', {count: selectedTransactionsKeys.length});

return (
<View style={[shouldShowSelectedDropdown && styles.ph5, styles.mb2, styles.searchFiltersBarContainer]}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ function Search({
if (!searchResults?.data) {
return [];
}
const columns = getColumnsToShow(accountID, searchResults?.data, false, searchResults?.search?.type);
const columns = getColumnsToShow(accountID, searchResults?.data, false, searchResults?.search?.type === CONST.SEARCH.DATA_TYPES.TASK);

return (Object.keys(columns) as SearchColumnType[]).filter((col) => columns[col]);
}, [accountID, searchResults?.data, searchResults?.search?.type]);
Expand Down Expand Up @@ -897,10 +897,10 @@ function Search({
navigation.setParams({q: newQuery});
};

const shouldShowYear = shouldShowYearUtil(searchResults?.data, isExpenseReportType ?? false);
const shouldShowYear = shouldShowYearUtil(searchResults?.data);
const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(searchResults?.data);
const shouldShowSorting = !validGroupBy;
const shouldShowTableHeader = isLargeScreenWidth && !isChat && !validGroupBy;
const shouldShowTableHeader = isLargeScreenWidth && !isChat && !validGroupBy && !isExpenseReportType;
const tableHeaderVisible = (canSelectMultiple || shouldShowTableHeader) && (!validGroupBy || isExpenseReportType);

return (
Expand Down

This file was deleted.

Loading