Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8b19ca5
fix: Expense report - Large amount is truncated in expense report.
Krishna2323 May 6, 2025
8f872b9
Merge branch 'Expensify:main' into krishna2323/issue/61078
Krishna2323 May 9, 2025
94e94d5
minor update.
Krishna2323 May 9, 2025
1115950
Merge branch 'Expensify:main' into krishna2323/issue/61078
Krishna2323 May 13, 2025
7b0d94b
set amount column width conditionally.
Krishna2323 May 20, 2025
cd11100
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 May 20, 2025
69aef81
remove commented code.
Krishna2323 May 20, 2025
4dd4e25
fix lint fails.
Krishna2323 May 21, 2025
22f2aef
add comment.
Krishna2323 May 21, 2025
d14189e
fix merge conflicts.
Krishna2323 May 22, 2025
2101345
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 May 22, 2025
a6de52d
minor fix.
Krishna2323 May 22, 2025
5ef04a6
calculate tax amount column width.
Krishna2323 May 22, 2025
b513447
fix ESLint
Krishna2323 May 22, 2025
39cf93c
fix: jest unit test.
Krishna2323 May 22, 2025
9ea3790
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 May 22, 2025
01ca7b7
remove duplicate imports.
Krishna2323 May 22, 2025
2cae329
refactor.
Krishna2323 May 23, 2025
1bed3a0
add test for getSearchTableYearAndAmountWidth.
Krishna2323 May 23, 2025
53c3973
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 May 27, 2025
07ba10f
fix prettier.
Krishna2323 May 27, 2025
087b466
minor style fix.
Krishna2323 Jun 4, 2025
cbf4a85
remove getCurrency util.
Krishna2323 Jun 4, 2025
f2ac532
fix merge conflicts.
Krishna2323 Jun 4, 2025
1536af6
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 Jun 4, 2025
f014278
fix merge conflicts.
Krishna2323 Jun 4, 2025
e7e4add
fix prettier.
Krishna2323 Jun 4, 2025
842fa6f
sync with main.
Krishna2323 Jun 9, 2025
bab3454
sync with main.
Krishna2323 Jun 9, 2025
1822d34
Merge branch 'Expensify:main' into krishna2323/issue/61078
Krishna2323 Jun 9, 2025
ff6e72d
create new function for amount and tax amount column width determinat…
Krishna2323 Jun 9, 2025
225490b
fix ESLint.
Krishna2323 Jun 9, 2025
24cf2b3
fix variable name.
Krishna2323 Jun 9, 2025
7c5a05a
minor updates.
Krishna2323 Jun 10, 2025
351b1e3
fix merge conflicts.
Krishna2323 Jun 12, 2025
fd0c889
Merge branch 'Expensify:main' into krishna2323/issue/61078
Krishna2323 Jun 12, 2025
2e6d08e
fix: MoneyRequestReportTransactionList component.
Krishna2323 Jun 12, 2025
c2e8ed5
fix getWideAmountIndicators logic.
Krishna2323 Jun 12, 2025
6fa2673
fix merge conflicts.
Krishna2323 Jun 12, 2025
f035af0
remove reduntant code block.
Krishna2323 Jun 12, 2025
6c65e8e
Merge branch 'main' into krishna2323/issue/61078
Krishna2323 Jun 12, 2025
0270f68
update unit tests.
Krishna2323 Jun 12, 2025
516c4d3
minor update.
Krishna2323 Jun 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ type SearchTableHeaderProps = {
sortOrder?: SortOrder;
onSortPress: (column: SortableColumnName, order: SortOrder) => void;
dateColumnSize: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
shouldShowSorting: boolean;
isIOUReport: boolean;
};

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

const shouldShowColumn = useCallback(
Expand All @@ -98,6 +100,8 @@ function MoneyRequestReportTableHeader({sortBy, sortOrder, onSortPress, dateColu
columns={columnConfig}
shouldShowColumn={shouldShowColumn}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
shouldShowSorting={shouldShowSorting}
sortBy={sortBy}
sortOrder={sortOrder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {isFullScreenName} from '@libs/Navigation/helpers/isNavigatorName';
import {navigationRef} from '@libs/Navigation/Navigation';
import {getIOUActionForTransactionID} from '@libs/ReportActionsUtils';
import {getMoneyRequestSpendBreakdown, isIOUReport} from '@libs/ReportUtils';
import {compareValues} from '@libs/SearchUIUtils';
import {compareValues, 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 @@ -236,9 +236,15 @@ function MoneyRequestReportTransactionList({
setActiveTransactionThreadIDs(sortedSiblingTransactionReportIDs);
}, [report.reportID, reportActions, transactions]);

const dateColumnSize = useMemo(() => {
const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo(() => {
const isAmountColumnWide = transactions.some((transaction) => isTransactionAmountTooLong(transaction));
const isTaxAmountColumnWide = transactions.some((transaction) => isTransactionTaxAmountTooLong(transaction));
const shouldShowYearForSomeTransaction = transactions.some((transaction) => shouldShowTransactionYear(transaction));
return shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
return {
amountColumnSize: isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
taxAmountColumnSize: isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
dateColumnSize: shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
};
}, [transactions]);

const pressableStyle = [styles.overflowHidden];
Expand Down Expand Up @@ -272,6 +278,8 @@ function MoneyRequestReportTransactionList({
sortBy={sortBy}
sortOrder={sortOrder}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
onSortPress={(selectedSortBy, selectedSortOrder) => {
if (!isSortableColumnName(selectedSortBy)) {
return;
Expand Down Expand Up @@ -330,6 +338,8 @@ function MoneyRequestReportTransactionList({
transactionItem={transaction}
isSelected={isTransactionSelected(transaction.transactionID)}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
shouldShowTooltip
shouldUseNarrowLayout={shouldUseNarrowLayout || isMediumScreenWidth}
shouldShowCheckbox={!!selectionMode?.isEnabled || !isSmallScreenWidth}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
getListItem,
getSections,
getSortedSections,
getWideAmountIndicators,
isReportActionListItemType,
isReportListItemType,
isSearchDataLoaded,
Expand Down Expand Up @@ -576,6 +577,7 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
};

const shouldShowYear = shouldShowYearUtil(searchResults?.data);
const {shouldShowAmountInWideColumn, shouldShowTaxAmountInWideColumn} = getWideAmountIndicators(searchResults?.data);
const shouldShowSorting = !Array.isArray(status) && !shouldGroupByReports;
const shouldShowTableHeader = isLargeScreenWidth && !isChat;

Expand All @@ -600,6 +602,8 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
sortOrder={sortOrder}
sortBy={sortBy}
shouldShowYear={shouldShowYear}
isAmountColumnWide={shouldShowAmountInWideColumn}
isTaxAmountColumnWide={shouldShowTaxAmountInWideColumn}
shouldShowSorting={shouldShowSorting}
/>
)
Expand Down
15 changes: 13 additions & 2 deletions src/components/SelectionList/Search/ReportListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import {isTransactionAmountTooLong, isTransactionTaxAmountTooLong} from '@libs/SearchUIUtils';
import shouldShowTransactionYear from '@libs/TransactionUtils/shouldShowTransactionYear';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -40,8 +42,15 @@ function ReportListItem<TItem extends ListItem>({
const isDisabledOrEmpty = isEmptyReport || isDisabled;
const {isLargeScreenWidth} = useResponsiveLayout();

const dateColumnSize = useMemo(() => {
return reportItem.transactions.some((transaction) => transaction.shouldShowYear) ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo(() => {
const isAmountColumnWide = reportItem.transactions.some((transaction) => isTransactionAmountTooLong(transaction));
const isTaxAmountColumnWide = reportItem.transactions.some((transaction) => isTransactionTaxAmountTooLong(transaction));
const shouldShowYearForSomeTransaction = reportItem.transactions.some((transaction) => shouldShowTransactionYear(transaction));
return {
amountColumnSize: isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
taxAmountColumnSize: isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
dateColumnSize: shouldShowYearForSomeTransaction ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
};
}, [reportItem.transactions]);

const animatedHighlightStyle = useAnimatedHighlightStyle({
Expand Down Expand Up @@ -144,6 +153,8 @@ function ReportListItem<TItem extends ListItem>({
transactionItem={transaction}
isSelected={!!transaction.isSelected}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
shouldShowTooltip={showTooltip}
shouldUseNarrowLayout={!isLargeScreenWidth}
shouldShowCheckbox={!!canSelectMultiple}
Expand Down
10 changes: 8 additions & 2 deletions src/components/SelectionList/Search/TransactionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ function TransactionListItem<TItem extends ListItem>({
backgroundColor: theme.highlightBG,
});

const dateColumnSize = useMemo(() => {
return transactionItem.shouldShowYear ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL;
const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo(() => {
return {
amountColumnSize: transactionItem.isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
taxAmountColumnSize: transactionItem.isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
dateColumnSize: transactionItem.shouldShowYear ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL,
};
}, [transactionItem]);

const columns = useMemo(
Expand Down Expand Up @@ -122,6 +126,8 @@ function TransactionListItem<TItem extends ListItem>({
isActionLoading={isLoading ?? transactionItem.isActionLoading}
isSelected={!!transactionItem.isSelected}
dateColumnSize={dateColumnSize}
amountColumnSize={amountColumnSize}
taxAmountColumnSize={taxAmountColumnSize}
shouldShowCheckbox={!!canSelectMultiple}
/>
</>
Expand Down
17 changes: 16 additions & 1 deletion src/components/SelectionList/SearchTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,24 @@ type SearchTableHeaderProps = {
sortOrder?: SortOrder;
onSortPress: (column: SearchColumnType, order: SortOrder) => void;
shouldShowYear: boolean;
isAmountColumnWide: boolean;
isTaxAmountColumnWide: boolean;
shouldShowSorting: boolean;
canSelectMultiple: boolean;
};

function SearchTableHeader({data, metadata, sortBy, sortOrder, onSortPress, shouldShowYear, shouldShowSorting, canSelectMultiple}: SearchTableHeaderProps) {
function SearchTableHeader({
data,
metadata,
sortBy,
sortOrder,
onSortPress,
shouldShowYear,
shouldShowSorting,
canSelectMultiple,
isAmountColumnWide,
isTaxAmountColumnWide,
}: SearchTableHeaderProps) {
const styles = useThemeStyles();
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
Expand Down Expand Up @@ -173,6 +186,8 @@ function SearchTableHeader({data, metadata, sortBy, sortOrder, onSortPress, shou
columns={columnConfig}
shouldShowColumn={shouldShowColumn}
dateColumnSize={shouldShowYear ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
amountColumnSize={isAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
taxAmountColumnSize={isTaxAmountColumnWide ? CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE : CONST.SEARCH.TABLE_COLUMN_SIZES.NORMAL}
shouldShowSorting={shouldShowSorting}
sortBy={sortBy}
sortOrder={sortOrder}
Expand Down
24 changes: 22 additions & 2 deletions src/components/SelectionList/SortableTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,25 @@ type SearchTableHeaderProps = {
sortOrder?: SortOrder;
shouldShowSorting: boolean;
dateColumnSize: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
containerStyles?: StyleProp<ViewStyle>;
shouldShowColumn: (columnName: SortableColumnName) => boolean;
onSortPress: (column: SortableColumnName, order: SortOrder) => void;
};

function SortableTableHeader({columns, sortBy, sortOrder, shouldShowColumn, dateColumnSize, containerStyles, shouldShowSorting, onSortPress}: SearchTableHeaderProps) {
function SortableTableHeader({
columns,
sortBy,
sortOrder,
shouldShowColumn,
dateColumnSize,
containerStyles,
shouldShowSorting,
onSortPress,
amountColumnSize,
taxAmountColumnSize,
}: SearchTableHeaderProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
Expand All @@ -51,7 +64,14 @@ function SortableTableHeader({columns, sortBy, sortOrder, shouldShowColumn, date
textStyle={textStyle}
sortOrder={sortOrder ?? CONST.SEARCH.SORT_ORDER.ASC}
isActive={isActive}
containerStyle={[StyleUtils.getReportTableColumnStyles(columnName, dateColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE)]}
containerStyle={[
StyleUtils.getReportTableColumnStyles(
columnName,
dateColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
amountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
taxAmountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE,
),
]}
isSortable={isSortable}
onPress={(order: SortOrder) => onSortPress(columnName, order)}
/>
Expand Down
4 changes: 4 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ type TransactionListItemType = ListItem &
*/
shouldShowYear: boolean;

isAmountColumnWide: boolean;

isTaxAmountColumnWide: boolean;

/** Key used internally by React */
keyForList: string;

Expand Down
12 changes: 10 additions & 2 deletions src/components/TransactionItemRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ type TransactionItemRowProps = {
isSelected: boolean;
shouldShowTooltip: boolean;
dateColumnSize: TableColumnSize;
amountColumnSize: TableColumnSize;
taxAmountColumnSize: TableColumnSize;
onCheckboxPress: (transactionID: string) => void;
shouldShowCheckbox: boolean;
columns?: Array<ValueOf<typeof CONST.REPORT.TRANSACTION_LIST.COLUMNS>>;
Expand Down Expand Up @@ -125,6 +127,8 @@ function TransactionItemRow({
isSelected,
shouldShowTooltip,
dateColumnSize,
amountColumnSize,
taxAmountColumnSize,
onCheckboxPress,
shouldShowCheckbox = false,
columns,
Expand All @@ -149,6 +153,8 @@ function TransactionItemRow({
const createdAt = getTransactionCreated(transactionItem);

const isDateColumnWide = dateColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isAmountColumnWide = amountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;
const isTaxAmountColumnWide = taxAmountColumnSize === CONST.SEARCH.TABLE_COLUMN_SIZES.WIDE;

const animatedHighlightStyle = useAnimatedHighlightStyle({
shouldHighlight: transactionItem.shouldBeHighlighted ?? false,
Expand Down Expand Up @@ -299,7 +305,7 @@ function TransactionItemRow({
</View>
),
[CONST.REPORT.TRANSACTION_LIST.COLUMNS.TOTAL_AMOUNT]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT)]}>
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT, undefined, isAmountColumnWide)]}>
<TotalCell
transactionItem={transactionItem}
shouldShowTooltip={shouldShowTooltip}
Expand All @@ -308,7 +314,7 @@ function TransactionItemRow({
</View>
),
[CONST.REPORT.TRANSACTION_LIST.COLUMNS.TAX]: (
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT)]}>
<View style={[StyleUtils.getReportTableColumnStyles(CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT, undefined, undefined, isTaxAmountColumnWide)]}>
<TaxCell
transactionItem={transactionItem}
shouldShowTooltip={shouldShowTooltip}
Expand All @@ -322,6 +328,8 @@ function TransactionItemRow({
isActionLoading,
isReportItemChild,
isDateColumnWide,
isAmountColumnWide,
isTaxAmountColumnWide,
isInSingleTransactionReport,
isSelected,
merchantOrDescriptionName,
Expand Down
Loading
Loading