Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
633ce2c
Auto hide from/to columns
youssef-lr Jun 4, 2025
82bda05
Bring back condition
youssef-lr Jun 5, 2025
2b2afc7
Initial work on animation
youssef-lr Jun 5, 2025
55d6356
Move animation to index page
youssef-lr Jun 5, 2025
4284d33
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jun 5, 2025
bfdcd7c
Don't reload initial transactions if we already have them
youssef-lr Jun 8, 2025
b0f4184
wip
youssef-lr Jun 12, 2025
0b20779
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jun 24, 2025
053844e
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jun 25, 2025
0e83ab9
Add From column logic
youssef-lr Jun 30, 2025
25d3ebe
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jun 30, 2025
e979eb3
Add Description column logic
youssef-lr Jun 30, 2025
ee24c8e
Bug fix
youssef-lr Jun 30, 2025
d81d2d0
Cleanup
youssef-lr Jun 30, 2025
08eabed
Remove unneeded comment
youssef-lr Jun 30, 2025
ea67e7e
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 1, 2025
22b36c4
Fix tests
youssef-lr Jul 1, 2025
a11aeac
Bug fix
youssef-lr Jul 1, 2025
2abbd15
Add animation
youssef-lr Jul 1, 2025
e3198e5
Lint
youssef-lr Jul 1, 2025
dd81dba
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 1, 2025
a7671af
Remove animation
youssef-lr Jul 2, 2025
a4a6314
Lint
youssef-lr Jul 2, 2025
820dcb9
Apply logic to the report view
youssef-lr Jul 2, 2025
7dc4e07
Lint
youssef-lr Jul 2, 2025
d030335
Lint
youssef-lr Jul 2, 2025
e54cd51
Show "Scanning" merchant if transaction is being scanned
youssef-lr Jul 3, 2025
ac5d7ea
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 3, 2025
f0291cd
Rename param and clean up code
youssef-lr Jul 3, 2025
6f808dd
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 7, 2025
f0541e2
Move logic of showing columns to the client
youssef-lr Jul 7, 2025
a6d1764
Fix check of empty values of tag & category
youssef-lr Jul 7, 2025
97c84d7
Fix bug in display of columns
youssef-lr Jul 7, 2025
4912f1e
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 14, 2025
b72eccb
Keep previously shown columns
youssef-lr Jul 14, 2025
65db2e5
Early return if no previous columns
youssef-lr Jul 14, 2025
04b8af8
Merge branch '@perunt/expenses-list-perf-on-web' into youssef_columns…
youssef-lr Jul 14, 2025
39e3614
Fixes
youssef-lr Jul 14, 2025
f3bd7f6
New animation approach
youssef-lr Jul 14, 2025
50ac518
Merge branch '@perunt/expenses-list-perf-on-web' into youssef_columns…
youssef-lr Jul 14, 2025
3991f81
Add entering/exiting animations
youssef-lr Jul 14, 2025
fe109d7
Fix double animation
youssef-lr Jul 14, 2025
548b7c2
Update animation
youssef-lr Jul 15, 2025
ec6cac9
Fix double animation
youssef-lr Jul 15, 2025
ffb16a0
Fix flashlist not re-rendering when columns change
youssef-lr Jul 16, 2025
3f63431
Bug fix and reduce animation duration
youssef-lr Jul 17, 2025
cf28ec8
Merge branch 'main' into youssef_columns_animation_4
youssef-lr Jul 17, 2025
883e410
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 17, 2025
0455bb3
Remove unneeded variable
youssef-lr Jul 17, 2025
90c3f5c
Fix lint
youssef-lr Jul 17, 2025
2f8ed6a
Fix TS
youssef-lr Jul 17, 2025
8d88f74
Remove unneeded type change
youssef-lr Jul 17, 2025
0ef7bcc
TS fix
youssef-lr Jul 17, 2025
f0f28c3
Add test
youssef-lr Jul 17, 2025
c3893f5
Style
youssef-lr Jul 17, 2025
45b4309
Remove unused column
youssef-lr Jul 17, 2025
03a863f
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 18, 2025
e00be41
Allow tweaking animation duration via console temporarily
youssef-lr Jul 18, 2025
25c7cc5
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 21, 2025
742802b
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 21, 2025
f75a898
Improve animation
youssef-lr Jul 22, 2025
bb82627
Remove previous columns logic
youssef-lr Jul 22, 2025
fe32c98
Don't refetch results when scrolling back to top
youssef-lr Jul 23, 2025
b15ec1e
Update src/types/onyx/SearchResults.ts
youssef-lr Jul 24, 2025
df7cf5a
Use constant for fade duration
youssef-lr Jul 24, 2025
bb62047
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 24, 2025
62cd320
Don't animate new columns on mobile
youssef-lr Jul 24, 2025
2ef632d
Fix To column showing when managerID=0
youssef-lr Jul 24, 2025
0af6093
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 25, 2025
1c62e31
Fix empty To column
youssef-lr Jul 25, 2025
0dd518b
Fix test
youssef-lr Jul 25, 2025
20e8c80
Fix value being overridden
youssef-lr Jul 25, 2025
8f24832
Fix TS
youssef-lr Jul 27, 2025
d6444c4
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 28, 2025
ec05816
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 28, 2025
2f9d48b
Apply suggestions from code review
youssef-lr Jul 29, 2025
af94c93
Merge branch 'main' into youssef_auto_show_hide_columns
youssef-lr Jul 31, 2025
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
4 changes: 4 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ const CONST = {
RECEIPT: 'receipt',
DATE: 'date',
MERCHANT: 'merchant',
DESCRIPTION: 'description',
FROM: 'from',
TO: 'to',
CATEGORY: 'category',
Expand Down Expand Up @@ -6451,6 +6452,9 @@ const CONST = {
UNAPPROVED_CASH: 'unapprovedCash',
UNAPPROVED_CARD: 'unapprovedCard',
},
ANIMATION: {
FADE_DURATION: 200,
},
},

EXPENSE: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@ type ColumnConfig = {
isColumnSortable?: boolean;
};

const shouldShowColumnConfig: Record<SortableColumnName, (isIOUReport: boolean) => boolean> = {
[CONST.SEARCH.TABLE_COLUMNS.RECEIPT]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.TYPE]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.DATE]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.MERCHANT]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: (isIOUReport) => !isIOUReport,
[CONST.SEARCH.TABLE_COLUMNS.TAG]: (isIOUReport) => !isIOUReport,
[CONST.REPORT.TRANSACTION_LIST.COLUMNS.COMMENTS]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT]: () => true,
[CONST.SEARCH.TABLE_COLUMNS.IN]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.FROM]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.TO]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.ACTION]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.TITLE]: () => false,
[CONST.SEARCH.TABLE_COLUMNS.ASSIGNEE]: () => false,
};

const columnConfig: ColumnConfig[] = [
{
columnName: CONST.SEARCH.TABLE_COLUMNS.RECEIPT,
Expand All @@ -51,6 +32,10 @@ const columnConfig: ColumnConfig[] = [
columnName: CONST.SEARCH.TABLE_COLUMNS.MERCHANT,
translationKey: 'common.merchant',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION,
translationKey: 'common.description',
},
{
columnName: CONST.SEARCH.TABLE_COLUMNS.CATEGORY,
translationKey: 'common.category',
Expand Down Expand Up @@ -78,22 +63,19 @@ type SearchTableHeaderProps = {
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
shouldShowSorting: boolean;
isIOUReport: boolean;
columns: SortableColumnName[];
};

function MoneyRequestReportTableHeader({sortBy, sortOrder, onSortPress, dateColumnSize, shouldShowSorting, isIOUReport, amountColumnSize, taxAmountColumnSize}: SearchTableHeaderProps) {
function MoneyRequestReportTableHeader({sortBy, sortOrder, onSortPress, dateColumnSize, shouldShowSorting, amountColumnSize, taxAmountColumnSize, columns}: SearchTableHeaderProps) {
const styles = useThemeStyles();

const shouldShowColumn = useCallback(
(columnName: SortableColumnName) => {
const shouldShowFun = shouldShowColumnConfig[columnName];
if (!shouldShowFun) {
return false;
}
return shouldShowFun(isIOUReport);
return columns.includes(columnName);
},
[isIOUReport],
[columns],
);

return (
<View style={[styles.dFlex, styles.flex5]}>
<SortableTableHeader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, {useEffect, useRef} from 'react';
import type {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import {getButtonRole} from '@components/Button/utils';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import {PressableWithFeedback} from '@components/Pressable';
import type {TableColumnSize} from '@components/Search/types';
import type {SortableColumnName} from '@components/SelectionList/types';
import TransactionItemRow from '@components/TransactionItemRow';
import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -17,17 +19,6 @@ import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {TransactionWithOptionalHighlight} from './MoneyRequestReportTransactionList';

const allReportColumns = [
CONST.REPORT.TRANSACTION_LIST.COLUMNS.RECEIPT,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.TYPE,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.DATE,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.MERCHANT,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.CATEGORY,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.TAG,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.COMMENTS,
CONST.REPORT.TRANSACTION_LIST.COLUMNS.TOTAL_AMOUNT,
];

type MoneyRequestReportTransactionItemProps = {
/** The transaction that is being displayed */
transaction: TransactionWithOptionalHighlight;
Expand Down Expand Up @@ -56,12 +47,16 @@ type MoneyRequestReportTransactionItemProps = {
/** The size of the tax amount column */
taxAmountColumnSize: TableColumnSize;

/** Columns to show */
columns: SortableColumnName[];

/** Callback function that scrolls to this transaction in case it is newly added */
scrollToNewTransaction?: (offset: number) => void;
};

function MoneyRequestReportTransactionItem({
transaction,
columns,
isSelectionModeEnabled,
toggleTransaction,
isSelected,
Expand Down Expand Up @@ -132,7 +127,7 @@ function MoneyRequestReportTransactionItem({
shouldUseNarrowLayout={shouldUseNarrowLayout || isMediumScreenWidth}
shouldShowCheckbox={!!isSelectionModeEnabled || !isSmallScreenWidth}
onCheckboxPress={toggleTransaction}
columns={allReportColumns}
columns={columns as Array<ValueOf<typeof CONST.REPORT.TRANSACTION_LIST.COLUMNS>>}
isDisabled={isPendingDelete}
/>
</PressableWithFeedback>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {setActiveTransactionIDs} from '@libs/actions/TransactionThreadNavigation
import {convertToDisplayString} from '@libs/CurrencyUtils';
import {navigationRef} from '@libs/Navigation/Navigation';
import {getIOUActionForTransactionID, getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils';
import {generateReportID, getMoneyRequestSpendBreakdown, isIOUReport} from '@libs/ReportUtils';
import {compareValues, isTransactionAmountTooLong, isTransactionTaxAmountTooLong} from '@libs/SearchUIUtils';
import {generateReportID, getMoneyRequestSpendBreakdown} from '@libs/ReportUtils';
import {compareValues, getColumnsToShow, isTransactionAmountTooLong, isTransactionTaxAmountTooLong} from '@libs/SearchUIUtils';
import {getTransactionPendingAction, isTransactionPendingDelete} from '@libs/TransactionUtils';
import shouldShowTransactionYear from '@libs/TransactionUtils/shouldShowTransactionYear';
import Navigation from '@navigation/Navigation';
Expand Down Expand Up @@ -164,6 +164,11 @@ function MoneyRequestReportTransactionList({
}));
}, [newTransactions, sortBy, sortOrder, transactions, localeCompare]);

const columnsToShow = useMemo(() => {
const columns = getColumnsToShow(transactions, true);
return (Object.keys(columns) as SortableColumnName[]).filter((column) => columns[column]);
}, [transactions]);

const navigateToTransaction = useCallback(
(activeTransactionID: string) => {
const iouAction = getIOUActionForTransactionID(reportActions, activeTransactionID);
Expand Down Expand Up @@ -274,6 +279,7 @@ function MoneyRequestReportTransactionList({
shouldShowSorting
sortBy={sortBy}
sortOrder={sortOrder}
columns={columnsToShow}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
Expand All @@ -284,7 +290,6 @@ function MoneyRequestReportTransactionList({

setSortConfig((prevState) => ({...prevState, sortBy: selectedSortBy, sortOrder: selectedSortOrder}));
}}
isIOUReport={isIOUReport(report)}
/>
)}
</View>
Expand All @@ -295,6 +300,7 @@ function MoneyRequestReportTransactionList({
<MoneyRequestReportTransactionItem
key={transaction.transactionID}
transaction={transaction}
columns={columnsToShow}
isSelectionModeEnabled={isMobileSelectionModeEnabled}
toggleTransaction={toggleTransaction}
isSelected={isTransactionSelected(transaction.transactionID)}
Expand Down
17 changes: 15 additions & 2 deletions src/components/Search/SearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import type ChatListItem from '@components/SelectionList/ChatListItem';
import type TaskListItem from '@components/SelectionList/Search/TaskListItem';
import type TransactionGroupListItem from '@components/SelectionList/Search/TransactionGroupListItem';
import type TransactionListItem from '@components/SelectionList/Search/TransactionListItem';
import type {ExtendedTargetedEvent, ReportActionListItemType, TaskListItemType, TransactionGroupListItemType, TransactionListItemType} from '@components/SelectionList/types';
import type {
ExtendedTargetedEvent,
ReportActionListItemType,
SortableColumnName,
TaskListItemType,
TransactionGroupListItemType,
TransactionListItemType,
} from '@components/SelectionList/types';
import Text from '@components/Text';
import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
import useInitialWindowDimensions from '@hooks/useInitialWindowDimensions';
Expand Down Expand Up @@ -79,6 +86,9 @@ type SearchListProps = Pick<FlashListProps<SearchListItem>, 'onScroll' | 'conten
/** The search query */
queryJSON: SearchQueryJSON;

/** Columns to show */
columns: SortableColumnName[];

/** Called when the viewability of rows changes, as defined by the viewabilityConfig prop. */
onViewableItemsChanged?: (info: {changed: ViewToken[]; viewableItems: ViewToken[]}) => void;

Expand Down Expand Up @@ -123,6 +133,7 @@ function SearchList(
shouldPreventDefaultFocusOnSelectRow,
shouldPreventLongPressRow,
queryJSON,
columns,
onViewableItemsChanged,
onLayout,
estimatedItemSize = ITEM_HEIGHTS.NARROW_WITHOUT_DRAWER.STANDARD,
Expand Down Expand Up @@ -332,6 +343,7 @@ function SearchList(
}}
shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow}
queryJSONHash={hash}
columns={columns}
policies={policies}
isDisabled={isDisabled}
allReports={allReports}
Expand All @@ -348,6 +360,7 @@ function SearchList(
onCheckboxPress,
onSelectRow,
policies,
columns,
hash,
groupBy,
setFocusedIndex,
Expand Down Expand Up @@ -445,7 +458,7 @@ function SearchList(
onScroll={onScroll}
showsVerticalScrollIndicator={false}
ref={listRef}
extraData={[focusedIndex, isFocused]}
extraData={[focusedIndex, isFocused, columns]}
onEndReached={onEndReached}
onEndReachedThreshold={onEndReachedThreshold}
ListFooterComponent={ListFooterComponent}
Expand Down
Loading
Loading