Skip to content

Commit c146413

Browse files
authored
Revert "Add support for groupBy week in Search"
1 parent ea82c73 commit c146413

28 files changed

Lines changed: 282 additions & 1237 deletions

src/CONST/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6893,7 +6893,6 @@ const CONST = {
68936893
MERCHANT: 'merchant',
68946894
TAG: 'tag',
68956895
MONTH: 'month',
6896-
WEEK: 'week',
68976896
},
68986897
get TYPE_CUSTOM_COLUMNS() {
68996898
return {
@@ -6990,11 +6989,6 @@ const CONST = {
69906989
EXPENSES: this.TABLE_COLUMNS.GROUP_EXPENSES,
69916990
TOTAL: this.TABLE_COLUMNS.GROUP_TOTAL,
69926991
},
6993-
WEEK: {
6994-
WEEK: this.TABLE_COLUMNS.GROUP_WEEK,
6995-
EXPENSES: this.TABLE_COLUMNS.GROUP_EXPENSES,
6996-
TOTAL: this.TABLE_COLUMNS.GROUP_TOTAL,
6997-
},
69986992
};
69996993
},
70006994
get TYPE_DEFAULT_COLUMNS() {
@@ -7040,7 +7034,6 @@ const CONST = {
70407034
MERCHANT: [this.TABLE_COLUMNS.GROUP_MERCHANT, this.TABLE_COLUMNS.GROUP_EXPENSES, this.TABLE_COLUMNS.GROUP_TOTAL],
70417035
TAG: [this.TABLE_COLUMNS.GROUP_TAG, this.TABLE_COLUMNS.GROUP_EXPENSES, this.TABLE_COLUMNS.GROUP_TOTAL],
70427036
MONTH: [this.TABLE_COLUMNS.GROUP_MONTH, this.TABLE_COLUMNS.GROUP_EXPENSES, this.TABLE_COLUMNS.GROUP_TOTAL],
7043-
WEEK: [this.TABLE_COLUMNS.GROUP_WEEK, this.TABLE_COLUMNS.GROUP_EXPENSES, this.TABLE_COLUMNS.GROUP_TOTAL],
70447037
};
70457038
},
70467039
BOOLEAN: {
@@ -7140,7 +7133,6 @@ const CONST = {
71407133
GROUP_MERCHANT: 'groupMerchant',
71417134
GROUP_TAG: 'groupTag',
71427135
GROUP_MONTH: 'groupmonth',
7143-
GROUP_WEEK: 'groupweek',
71447136
},
71457137
SYNTAX_OPERATORS: {
71467138
AND: 'and',
@@ -7332,8 +7324,6 @@ const CONST = {
73327324
[this.TABLE_COLUMNS.GROUP_CATEGORY]: 'group-category',
73337325
[this.TABLE_COLUMNS.GROUP_MERCHANT]: 'group-merchant',
73347326
[this.TABLE_COLUMNS.GROUP_TAG]: 'group-tag',
7335-
[this.TABLE_COLUMNS.GROUP_MONTH]: 'group-month',
7336-
[this.TABLE_COLUMNS.GROUP_WEEK]: 'group-week',
73377327
};
73387328
},
73397329
NOT_MODIFIER: 'Not',

src/components/Search/SearchList/index.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import type {
3030
TransactionListItemType,
3131
TransactionMerchantGroupListItemType,
3232
TransactionMonthGroupListItemType,
33-
TransactionWeekGroupListItemType,
3433
} from '@components/SelectionListWithSections/types';
3534
import Text from '@components/Text';
3635
import useKeyboardState from '@hooks/useKeyboardState';
@@ -168,13 +167,6 @@ function isTransactionMatchWithGroupItem(transaction: Transaction, groupItem: Se
168167
const transactionDateString = transaction.modifiedCreated ?? transaction.created ?? '';
169168
return DateUtils.isDateStringInMonth(transactionDateString, monthGroup.year, monthGroup.month);
170169
}
171-
if (groupBy === CONST.SEARCH.GROUP_BY.WEEK) {
172-
const weekGroup = groupItem as TransactionWeekGroupListItemType;
173-
const transactionDateString = transaction.modifiedCreated ?? transaction.created ?? '';
174-
const datePart = transactionDateString.substring(0, 10);
175-
const {start: weekStart, end: weekEnd} = DateUtils.getWeekDateRange(weekGroup.week);
176-
return datePart >= weekStart && datePart <= weekEnd;
177-
}
178170
return false;
179171
}
180172

src/components/Search/index.tsx

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {isSplitAction} from '@libs/ReportSecondaryActionUtils';
4141
import {canEditFieldOfMoneyRequest, canHoldUnholdReportAction, canRejectReportAction, isOneTransactionReport, selectFilteredReportActions} from '@libs/ReportUtils';
4242
import {buildCannedSearchQuery, buildSearchQueryJSON, buildSearchQueryString} from '@libs/SearchQueryUtils';
4343
import {
44-
adjustTimeRangeToDateFilters,
4544
createAndOpenSearchTransactionThread,
4645
getColumnsToShow,
4746
getListItem,
@@ -61,7 +60,6 @@ import {
6160
isTransactionMerchantGroupListItemType,
6261
isTransactionMonthGroupListItemType,
6362
isTransactionTagGroupListItemType,
64-
isTransactionWeekGroupListItemType,
6563
isTransactionWithdrawalIDGroupListItemType,
6664
shouldShowEmptyState,
6765
shouldShowYear as shouldShowYearUtil,
@@ -547,7 +545,7 @@ function Search({
547545

548546
// For expense reports: when ANY transaction is selected, we want ALL transactions in the report selected.
549547
// This ensures report-level selection persists when new transactions are added.
550-
const hasAnySelected = isExpenseReportType && transactionGroup.transactions.some((transaction: TransactionListItemType) => transaction.transactionID in selectedTransactions);
548+
const hasAnySelected = isExpenseReportType && transactionGroup.transactions.some((transaction) => transaction.transactionID in selectedTransactions);
551549

552550
for (const transactionItem of transactionGroup.transactions) {
553551
const isSelected = transactionItem.transactionID in selectedTransactions;
@@ -907,47 +905,13 @@ function Search({
907905
return;
908906
}
909907

910-
if (isTransactionWeekGroupListItemType(item)) {
911-
const weekGroupItem = item;
912-
if (!weekGroupItem.week) {
913-
return;
914-
}
915-
// Extract the existing date filter to check for year-to-date or other date limits
916-
const existingDateFilter = queryJSON.flatFilters.find((filter) => filter.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE);
917-
const {start: weekStart, end: weekEnd} = adjustTimeRangeToDateFilters(DateUtils.getWeekDateRange(weekGroupItem.week), existingDateFilter);
918-
const newFlatFilters = queryJSON.flatFilters.filter((filter) => filter.key !== CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE);
919-
newFlatFilters.push({
920-
key: CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE,
921-
filters: [
922-
{operator: CONST.SEARCH.SYNTAX_OPERATORS.GREATER_THAN_OR_EQUAL_TO, value: weekStart},
923-
{operator: CONST.SEARCH.SYNTAX_OPERATORS.LOWER_THAN_OR_EQUAL_TO, value: weekEnd},
924-
],
925-
});
926-
const newQueryJSON: SearchQueryJSON = {...queryJSON, groupBy: undefined, flatFilters: newFlatFilters};
927-
const newQuery = buildSearchQueryString(newQueryJSON);
928-
const newQueryJSONWithHash = buildSearchQueryJSON(newQuery);
929-
if (!newQueryJSONWithHash) {
930-
return;
931-
}
932-
handleSearch({queryJSON: newQueryJSONWithHash, searchKey, offset: 0, shouldCalculateTotals: false, isLoading: false});
933-
return;
934-
}
935-
936-
// After handling all group types, item should be TransactionListItemType or ReportActionListItemType
937-
if (!isTransactionItem && !isReportActionListItemType(item)) {
938-
return;
939-
}
940-
941-
const transactionItem = item as TransactionListItemType;
942-
const reportActionItem = item as ReportActionListItemType;
943-
944-
let reportID = transactionItem.reportID ?? reportActionItem.reportID;
945-
if (isTransactionItem && transactionItem?.reportAction?.childReportID) {
946-
const isFromSelfDM = transactionItem.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
947-
const isFromOneTransactionReport = isOneTransactionReport(transactionItem.report);
908+
let reportID = item.reportID;
909+
if (isTransactionItem && item?.reportAction?.childReportID) {
910+
const isFromSelfDM = item.reportID === CONST.REPORT.UNREPORTED_REPORT_ID;
911+
const isFromOneTransactionReport = isOneTransactionReport(item.report);
948912

949913
if (isFromSelfDM || !isFromOneTransactionReport) {
950-
reportID = transactionItem?.reportAction?.childReportID;
914+
reportID = item?.reportAction?.childReportID;
951915
}
952916
}
953917

@@ -963,17 +927,16 @@ function Search({
963927
});
964928

965929
if (isTransactionGroupListItemType(item)) {
966-
const groupItem = item as TransactionGroupListItemType;
967-
const firstTransaction = groupItem.transactions.at(0);
968-
if (groupItem.isOneTransactionReport && firstTransaction && transactionPreviewData) {
930+
const firstTransaction = item.transactions.at(0);
931+
if (item.isOneTransactionReport && firstTransaction && transactionPreviewData) {
969932
if (!firstTransaction?.reportAction?.childReportID) {
970933
createAndOpenSearchTransactionThread(firstTransaction, backTo, firstTransaction?.reportAction?.childReportID, transactionPreviewData, false);
971934
} else {
972935
setOptimisticDataForTransactionThreadPreview(firstTransaction, transactionPreviewData, firstTransaction?.reportAction?.childReportID);
973936
}
974937
}
975938

976-
if (groupItem.transactions.length > 1) {
939+
if (item.transactions.length > 1) {
977940
markReportIDAsMultiTransactionExpense(reportID);
978941
} else {
979942
unmarkReportIDAsMultiTransactionExpense(reportID);
@@ -984,15 +947,15 @@ function Search({
984947
}
985948

986949
if (isReportActionListItemType(item)) {
987-
const reportActionID = reportActionItem.reportActionID;
950+
const reportActionID = item.reportActionID;
988951
Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, reportActionID, backTo}));
989952
return;
990953
}
991954

992955
markReportIDAsExpense(reportID);
993956

994957
if (isTransactionItem && transactionPreviewData) {
995-
setOptimisticDataForTransactionThreadPreview(transactionItem, transactionPreviewData, transactionItem?.reportAction?.childReportID);
958+
setOptimisticDataForTransactionThreadPreview(item, transactionPreviewData, item?.reportAction?.childReportID);
996959
}
997960

998961
requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID, backTo})));

src/components/SelectionListWithSections/Search/BaseListItemHeader.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ type GroupColumnKey =
3030
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_CATEGORY
3131
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_MERCHANT
3232
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_TAG
33-
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_MONTH
34-
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_WEEK;
33+
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_MONTH;
3534

3635
/** Supported column style keys for sizing */
3736
type ColumnStyleKey =
3837
| typeof CONST.SEARCH.TABLE_COLUMNS.CATEGORY
3938
| typeof CONST.SEARCH.TABLE_COLUMNS.MERCHANT
4039
| typeof CONST.SEARCH.TABLE_COLUMNS.TAG
41-
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_MONTH
42-
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_WEEK;
40+
| typeof CONST.SEARCH.TABLE_COLUMNS.GROUP_MONTH;
4341

4442
type BaseListItemHeaderProps<TItem extends ListItem> = {
4543
/** The group item being rendered */

src/components/SelectionListWithSections/Search/TransactionGroupListItem.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import type {
2222
TransactionMonthGroupListItemType,
2323
TransactionReportGroupListItemType,
2424
TransactionTagGroupListItemType,
25-
TransactionWeekGroupListItemType,
2625
TransactionWithdrawalIDGroupListItemType,
2726
} from '@components/SelectionListWithSections/types';
2827
import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle';
@@ -51,7 +50,6 @@ import MonthListItemHeader from './MonthListItemHeader';
5150
import ReportListItemHeader from './ReportListItemHeader';
5251
import TagListItemHeader from './TagListItemHeader';
5352
import TransactionGroupListExpandedItem from './TransactionGroupListExpanded';
54-
import WeekListItemHeader from './WeekListItemHeader';
5553
import WithdrawalIDListItemHeader from './WithdrawalIDListItemHeader';
5654

5755
function TransactionGroupListItem<TItem extends ListItem>({
@@ -342,19 +340,6 @@ function TransactionGroupListItem<TItem extends ListItem>({
342340
isExpanded={isExpanded}
343341
/>
344342
),
345-
[CONST.SEARCH.GROUP_BY.WEEK]: (
346-
<WeekListItemHeader
347-
week={groupItem as TransactionWeekGroupListItemType}
348-
onCheckboxPress={onCheckboxPress}
349-
isDisabled={isDisabledOrEmpty}
350-
columns={columns}
351-
canSelectMultiple={canSelectMultiple}
352-
isSelectAllChecked={isSelectAllChecked}
353-
isIndeterminate={isIndeterminate}
354-
onDownArrowClick={onExpandIconPress}
355-
isExpanded={isExpanded}
356-
/>
357-
),
358343
};
359344

360345
if (searchType === CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT) {

src/components/SelectionListWithSections/Search/WeekListItemHeader.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/components/SelectionListWithSections/SearchTableHeader.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -409,24 +409,6 @@ const getTransactionGroupHeaders = (groupBy: SearchGroupBy, icons: SearchHeaderI
409409
isColumnSortable: true,
410410
},
411411
];
412-
case CONST.SEARCH.GROUP_BY.WEEK:
413-
return [
414-
{
415-
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_WEEK,
416-
translationKey: 'common.week',
417-
isColumnSortable: true,
418-
},
419-
{
420-
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_EXPENSES,
421-
translationKey: 'common.expenses',
422-
isColumnSortable: true,
423-
},
424-
{
425-
columnName: CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL,
426-
translationKey: 'common.total',
427-
isColumnSortable: true,
428-
},
429-
];
430412
default:
431413
return [];
432414
}

src/components/SelectionListWithSections/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import type {
3838
SearchTagGroup,
3939
SearchTask,
4040
SearchTransactionAction,
41-
SearchWeekGroup,
4241
SearchWithdrawalIDGroup,
4342
} from '@src/types/onyx/SearchResults';
4443
import type {ReceiptErrors} from '@src/types/onyx/Transaction';
@@ -524,11 +523,6 @@ type TransactionTagGroupListItemType = TransactionGroupListItemType & {groupedBy
524523
formattedTag?: string;
525524
};
526525

527-
type TransactionWeekGroupListItemType = TransactionGroupListItemType & {groupedBy: typeof CONST.SEARCH.GROUP_BY.WEEK} & SearchWeekGroup & {
528-
/** Final and formatted "week" value used for displaying */
529-
formattedWeek: string;
530-
};
531-
532526
type ListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
533527
/** The section list item */
534528
item: TItem;
@@ -1174,7 +1168,6 @@ export type {
11741168
TransactionCategoryGroupListItemType,
11751169
TransactionMerchantGroupListItemType,
11761170
TransactionTagGroupListItemType,
1177-
TransactionWeekGroupListItemType,
11781171
Section,
11791172
SectionListDataType,
11801173
SectionWithIndexOffset,

src/languages/de.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ const translations: TranslationDeepObject<typeof en> = {
641641
newFeature: 'Neue Funktion',
642642
month: 'Monat',
643643
home: 'Startseite',
644-
week: 'Woche',
645644
},
646645
supportalNoAccess: {
647646
title: 'Nicht so schnell',
@@ -7003,7 +7002,6 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
70037002
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Händler',
70047003
[CONST.SEARCH.GROUP_BY.TAG]: 'Stichwort',
70057004
[CONST.SEARCH.GROUP_BY.MONTH]: 'Monat',
7006-
[CONST.SEARCH.GROUP_BY.WEEK]: 'Woche',
70077005
},
70087006
feed: 'Feed',
70097007
withdrawalType: {

src/languages/en.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ const translations = {
633633
reimbursableTotal: 'Reimbursable total',
634634
nonReimbursableTotal: 'Non-reimbursable total',
635635
month: 'Month',
636-
week: 'Week',
637636
},
638637
supportalNoAccess: {
639638
title: 'Not so fast',
@@ -6894,7 +6893,6 @@ const translations = {
68946893
[CONST.SEARCH.GROUP_BY.MERCHANT]: 'Merchant',
68956894
[CONST.SEARCH.GROUP_BY.TAG]: 'Tag',
68966895
[CONST.SEARCH.GROUP_BY.MONTH]: 'Month',
6897-
[CONST.SEARCH.GROUP_BY.WEEK]: 'Week',
68986896
},
68996897
feed: 'Feed',
69006898
withdrawalType: {

0 commit comments

Comments
 (0)