From 5469b5dd7985cf2740ebf125e846ca5d7277a257 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:12:34 -0500 Subject: [PATCH 01/24] add to consts --- src/CONST/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index f3eb3f1e4567..ef0486006e04 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6707,6 +6707,7 @@ const CONST = { MERCHANT: this.TABLE_COLUMNS.MERCHANT, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, + WORKSPACE: this.TABLE_COLUMNS.WORKSPACE, CATEGORY: this.TABLE_COLUMNS.CATEGORY, TAG: this.TABLE_COLUMNS.TAG, ACTION: this.TABLE_COLUMNS.ACTION, @@ -6717,6 +6718,7 @@ const CONST = { TITLE: this.TABLE_COLUMNS.TITLE, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, + WORKSPACE: this.TABLE_COLUMNS.WORKSPACE, ACTION: this.TABLE_COLUMNS.ACTION, }, INVOICE: {}, @@ -6806,6 +6808,7 @@ const CONST = { IN: 'in', COMMENTS: 'comments', CARD: 'card', + WORKSPACE: 'workspace', WITHDRAWAL_ID: 'withdrawalID', AVATAR: 'avatar', STATUS: 'status', From 5706a1ce99120db3a2d1f8bfc2b44249df047dc2 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:14:10 -0500 Subject: [PATCH 02/24] add workspace translation and visibility --- src/libs/SearchUIUtils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 1f6acf88a6eb..e1d5732c3d6d 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2109,6 +2109,8 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla return 'common.title'; case CONST.SEARCH.TABLE_COLUMNS.STATUS: return 'common.status'; + case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: + return 'workspace.common.workspace'; } } @@ -2493,6 +2495,7 @@ function getColumnsToShow( CONST.SEARCH.TABLE_COLUMNS.TITLE, CONST.SEARCH.TABLE_COLUMNS.FROM, CONST.SEARCH.TABLE_COLUMNS.TO, + CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, CONST.SEARCH.TABLE_COLUMNS.TOTAL, CONST.SEARCH.TABLE_COLUMNS.ACTION, ]; @@ -2561,6 +2564,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: false, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: false, + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, [CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: false, [CONST.SEARCH.TABLE_COLUMNS.TAG]: false, [CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: false, From 90434495afdc2e9113684d1d87fa25c7059c2a8a Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:14:54 -0500 Subject: [PATCH 03/24] add headers --- .../SelectionListWithSections/SearchTableHeader.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/SelectionListWithSections/SearchTableHeader.tsx b/src/components/SelectionListWithSections/SearchTableHeader.tsx index 023b27487151..61daaa6ad5a3 100644 --- a/src/components/SelectionListWithSections/SearchTableHeader.tsx +++ b/src/components/SelectionListWithSections/SearchTableHeader.tsx @@ -87,6 +87,10 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [ translationKey: 'common.action', isColumnSortable: false, }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + translationKey: 'workspace.common.workspace', + }, ]; const taskHeaders: SearchColumnConfig[] = [ @@ -165,6 +169,10 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[] translationKey: 'common.action', isColumnSortable: false, }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + translationKey: 'workspace.common.workspace', + }, ]; function getSearchColumns(type: ValueOf, groupBy?: SearchGroupBy, profileIcon?: IconAsset) { From 9d3b29fc808de5bf45772da172e3eb424c8f6ce9 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:18:20 -0500 Subject: [PATCH 04/24] add workspace widths --- .../Search/ExpenseReportListItemRow.tsx | 1 + src/components/TransactionItemRow/index.tsx | 1 + src/styles/utils/index.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index 53547f29416e..ccf8f22612f5 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -148,6 +148,7 @@ function ExpenseReportListItemRow({ /> ), + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: , }; const thereIsFromAndTo = !!item?.from && !!item?.to; diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index e48b8c0f9519..816759657ad9 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -380,6 +380,7 @@ function TransactionItemRow({ /> ), + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: , }), [ StyleUtils, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 5e2e98089d5f..edaea2475dbc 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1756,6 +1756,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.ACTION: columnWidth = {...getWidthStyle(variables.w80), ...styles.alignItemsCenter}; break; + case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: case CONST.SEARCH.TABLE_COLUMNS.MERCHANT: case CONST.SEARCH.TABLE_COLUMNS.FROM: case CONST.SEARCH.TABLE_COLUMNS.TO: From b44538338aacb5407b36e1899fd6544e4e8de75c Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:34:50 -0500 Subject: [PATCH 05/24] add cols for workspace --- .../Search/ExpenseReportListItemRow.tsx | 23 +++++++- .../SearchTableHeader.tsx | 8 +-- src/components/TransactionItemRow/index.tsx | 54 ++++++++++++++----- src/styles/utils/index.ts | 2 + src/styles/variables.ts | 1 + 5 files changed, 69 insertions(+), 19 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index ccf8f22612f5..bdf820a15ec5 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -1,17 +1,20 @@ import React, {Fragment, useMemo} from 'react'; import {View} from 'react-native'; import type {StyleProp, ViewStyle} from 'react-native'; +import Avatar from '@components/Avatar'; import Checkbox from '@components/Checkbox'; import Icon from '@components/Icon'; import ReportActionAvatars from '@components/ReportActionAvatars'; import ReportSearchHeader from '@components/ReportSearchHeader'; import type {SearchColumnType} from '@components/Search/types'; import type {ExpenseReportListItemType} from '@components/SelectionListWithSections/types'; +import TextWithTooltip from '@components/TextWithTooltip'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import {getPolicyName, getWorkspaceIcon} from '@libs/ReportUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import type {Policy} from '@src/types/onyx'; @@ -148,7 +151,25 @@ function ExpenseReportListItemRow({ /> ), - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: , + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( + + + + + + + ), }; const thereIsFromAndTo = !!item?.from && !!item?.to; diff --git a/src/components/SelectionListWithSections/SearchTableHeader.tsx b/src/components/SelectionListWithSections/SearchTableHeader.tsx index 61daaa6ad5a3..2092974294d5 100644 --- a/src/components/SelectionListWithSections/SearchTableHeader.tsx +++ b/src/components/SelectionListWithSections/SearchTableHeader.tsx @@ -160,6 +160,10 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[] columnName: CONST.SEARCH.TABLE_COLUMNS.TO, translationKey: 'common.to', }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + translationKey: 'workspace.common.workspace', + }, { columnName: CONST.SEARCH.TABLE_COLUMNS.TOTAL, translationKey: 'common.total', @@ -169,10 +173,6 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[] translationKey: 'common.action', isColumnSortable: false, }, - { - columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, - translationKey: 'workspace.common.workspace', - }, ]; function getSearchColumns(type: ValueOf, groupBy?: SearchGroupBy, profileIcon?: IconAsset) { diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 816759657ad9..8f34f09ab8f1 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -2,6 +2,7 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; import type {StyleProp, ViewStyle} from 'react-native'; import type {ValueOf} from 'type-fest'; +import Avatar from '@components/Avatar'; import Checkbox from '@components/Checkbox'; import Icon from '@components/Icon'; import type {TransactionWithOptionalHighlight} from '@components/MoneyRequestReportView/MoneyRequestReportTransactionList'; @@ -12,6 +13,7 @@ import ActionCell from '@components/SelectionListWithSections/Search/ActionCell' import DateCell from '@components/SelectionListWithSections/Search/DateCell'; import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell'; import Text from '@components/Text'; +import TextWithTooltip from '@components/TextWithTooltip'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -19,7 +21,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {isCategoryMissing} from '@libs/CategoryUtils'; -import {isSettled} from '@libs/ReportUtils'; +import {getPolicyName, getWorkspaceIcon, isSettled} from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; import { getDescription, @@ -380,27 +382,51 @@ function TransactionItemRow({ /> ), - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: , + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( + + + + + + + ), }), [ StyleUtils, + transactionItem, + shouldShowTooltip, + shouldUseNarrowLayout, + isSelected, + isDateColumnWide, + areAllOptionalColumnsHidden, createdAt, - isActionLoading, isReportItemChild, - isDateColumnWide, - isAmountColumnWide, - isTaxAmountColumnWide, - isInSingleTransactionReport, - isSelected, - merchant, - description, onButtonPress, - shouldShowTooltip, - shouldUseNarrowLayout, - transactionItem, + isActionLoading, report?.policyID, report?.total, - areAllOptionalColumnsHidden, + merchant, + description, + isInSingleTransactionReport, + isAmountColumnWide, + isTaxAmountColumnWide, + styles.flexRow, + styles.gap3, + styles.flex1, + styles.alignItemsCenter, + styles.alignSelfCenter, + styles.flexGrow1, ], ); const shouldRenderChatBubbleCell = useMemo(() => { diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index edaea2475dbc..8cd8a2d6f1b7 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1757,6 +1757,8 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ columnWidth = {...getWidthStyle(variables.w80), ...styles.alignItemsCenter}; break; case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: + columnWidth = {...getWidthStyle(variables.w200)}; + break; case CONST.SEARCH.TABLE_COLUMNS.MERCHANT: case CONST.SEARCH.TABLE_COLUMNS.FROM: case CONST.SEARCH.TABLE_COLUMNS.TO: diff --git a/src/styles/variables.ts b/src/styles/variables.ts index 49e33bcd2101..8a7277c78a84 100644 --- a/src/styles/variables.ts +++ b/src/styles/variables.ts @@ -341,6 +341,7 @@ export default { w130: 130, w184: 184, w191: 191, + w200: 200, // Transaction item row heights based on layout types // Wide screen (desktop) layout optionRowWideItemHeight: 64, From 3368635a181a12783b93e200423d4d9359ec4c86 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:35:25 -0500 Subject: [PATCH 06/24] cleanup code --- .../Search/ExpenseReportListItemRow.tsx | 2 +- .../SelectionListWithSections/SearchTableHeader.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index bdf820a15ec5..b4c0ff4a053a 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -159,7 +159,7 @@ function ExpenseReportListItemRow({ size={CONST.AVATAR_SIZE.MID_SUBSCRIPT} source={getWorkspaceIcon(item).source} avatarID={item.policyID} - name={item.policyName ?? ''} + name={getPolicyName({report: item})} type={CONST.ICON_TYPE_WORKSPACE} /> [ translationKey: 'common.to', canBeMissing: true, }, + { + columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + translationKey: 'workspace.common.workspace', + }, { columnName: CONST.SEARCH.TABLE_COLUMNS.CARD, translationKey: 'common.card', @@ -87,10 +91,6 @@ const getExpenseHeaders = (groupBy?: SearchGroupBy): SearchColumnConfig[] => [ translationKey: 'common.action', isColumnSortable: false, }, - { - columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, - translationKey: 'workspace.common.workspace', - }, ]; const taskHeaders: SearchColumnConfig[] = [ From 6299b2d21618fc0b721fb50001265df24f3ba926 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:44:10 -0500 Subject: [PATCH 07/24] add workspace cell component --- .../Search/WorkspaceCell.tsx | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/components/SelectionListWithSections/Search/WorkspaceCell.tsx diff --git a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx new file mode 100644 index 000000000000..a99afaef344d --- /dev/null +++ b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx @@ -0,0 +1,43 @@ +import React from 'react'; +import {View} from 'react-native'; +import Avatar from '@components/Avatar'; +import TextWithTooltip from '@components/TextWithTooltip'; +import useOnyx from '@hooks/useOnyx'; +import useThemeStyles from '@hooks/useThemeStyles'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; + +type WorkspaceCellProps = { + policyID?: string; +}; + +function WorkspaceCell({policyID}: WorkspaceCellProps) { + const styles = useThemeStyles(); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true}); + + if (!policyID || !policy) { + return null; + } + + return ( + + + + + ); +} + +WorkspaceCell.displayName = 'ReportInfoCell'; + +export default WorkspaceCell; From 72f3d1ebb503ae756d15ffd9c805b647626c5a04 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:45:19 -0500 Subject: [PATCH 08/24] implement cells for workspace --- .../Search/ExpenseReportListItemRow.tsx | 20 ++------------ src/components/TransactionItemRow/index.tsx | 27 +++---------------- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index b4c0ff4a053a..c7e9dc315d32 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -1,20 +1,17 @@ import React, {Fragment, useMemo} from 'react'; import {View} from 'react-native'; import type {StyleProp, ViewStyle} from 'react-native'; -import Avatar from '@components/Avatar'; import Checkbox from '@components/Checkbox'; import Icon from '@components/Icon'; import ReportActionAvatars from '@components/ReportActionAvatars'; import ReportSearchHeader from '@components/ReportSearchHeader'; import type {SearchColumnType} from '@components/Search/types'; import type {ExpenseReportListItemType} from '@components/SelectionListWithSections/types'; -import TextWithTooltip from '@components/TextWithTooltip'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import {getPolicyName, getWorkspaceIcon} from '@libs/ReportUtils'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import type {Policy} from '@src/types/onyx'; @@ -25,6 +22,7 @@ import TitleCell from './TitleCell'; import TotalCell from './TotalCell'; import UserInfoAndActionButtonRow from './UserInfoAndActionButtonRow'; import UserInfoCell from './UserInfoCell'; +import WorkspaceCell from './WorkspaceCell'; type ExpenseReportListItemRowProps = { item: ExpenseReportListItemType; @@ -153,21 +151,7 @@ function ExpenseReportListItemRow({ ), [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( - - - - + ), }; diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index 8f34f09ab8f1..24a2512d8c8d 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -2,7 +2,6 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; import type {StyleProp, ViewStyle} from 'react-native'; import type {ValueOf} from 'type-fest'; -import Avatar from '@components/Avatar'; import Checkbox from '@components/Checkbox'; import Icon from '@components/Icon'; import type {TransactionWithOptionalHighlight} from '@components/MoneyRequestReportView/MoneyRequestReportTransactionList'; @@ -12,8 +11,8 @@ import type {SearchColumnType, TableColumnSize} from '@components/Search/types'; import ActionCell from '@components/SelectionListWithSections/Search/ActionCell'; import DateCell from '@components/SelectionListWithSections/Search/DateCell'; import UserInfoCell from '@components/SelectionListWithSections/Search/UserInfoCell'; +import WorkspaceCell from '@components/SelectionListWithSections/Search/WorkspaceCell'; import Text from '@components/Text'; -import TextWithTooltip from '@components/TextWithTooltip'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; @@ -21,7 +20,7 @@ import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {isCategoryMissing} from '@libs/CategoryUtils'; -import {getPolicyName, getWorkspaceIcon, isSettled} from '@libs/ReportUtils'; +import {isSettled} from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; import { getDescription, @@ -384,21 +383,7 @@ function TransactionItemRow({ ), [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( - - - - + ), }), @@ -421,12 +406,6 @@ function TransactionItemRow({ isInSingleTransactionReport, isAmountColumnWide, isTaxAmountColumnWide, - styles.flexRow, - styles.gap3, - styles.flex1, - styles.alignItemsCenter, - styles.alignSelfCenter, - styles.flexGrow1, ], ); const shouldRenderChatBubbleCell = useMemo(() => { From adf595b342dc5b247a800ddef6f6f453d8486ce5 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 10:52:52 -0500 Subject: [PATCH 09/24] fix reports behavior with columns showing everything. Only shoiw dfeeaults --- src/libs/SearchUIUtils.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index e1d5732c3d6d..dc265d6c735c 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2500,21 +2500,17 @@ function getColumnsToShow( CONST.SEARCH.TABLE_COLUMNS.ACTION, ]; - // If there are no visible columns, everything should be visible - if (!visibleColumns.length) { - return Object.fromEntries(reportColumns.map((column) => [column, true])); - } - // If the user has set custom columns, toggle the visible columns on, with all other // columns hidden by default const columns: ColumnVisibility = {}; const requiredColumns = new Set([CONST.SEARCH.TABLE_COLUMNS.AVATAR, CONST.SEARCH.TABLE_COLUMNS.TOTAL]); + const columnsToShow = visibleColumns.length ? visibleColumns : CONST.SEARCH.DEFAULT_COLUMNS.EXPENSE_REPORT; for (const columnId of reportColumns) { columns[columnId] = requiredColumns.has(columnId); } - for (const column of visibleColumns) { + for (const column of columnsToShow) { columns[column as keyof ColumnVisibility] = true; } From 3599d043f1a6ed6ae49673c93c3082d1d998f1ee Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 11:28:01 -0500 Subject: [PATCH 10/24] sort by workspace --- src/CONST/index.ts | 2 +- src/styles/utils/index.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index ef0486006e04..a36f124866c4 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6808,7 +6808,7 @@ const CONST = { IN: 'in', COMMENTS: 'comments', CARD: 'card', - WORKSPACE: 'workspace', + WORKSPACE: 'policyname', WITHDRAWAL_ID: 'withdrawalID', AVATAR: 'avatar', STATUS: 'status', diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 8cd8a2d6f1b7..edaea2475dbc 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1757,8 +1757,6 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ columnWidth = {...getWidthStyle(variables.w80), ...styles.alignItemsCenter}; break; case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: - columnWidth = {...getWidthStyle(variables.w200)}; - break; case CONST.SEARCH.TABLE_COLUMNS.MERCHANT: case CONST.SEARCH.TABLE_COLUMNS.FROM: case CONST.SEARCH.TABLE_COLUMNS.TO: From c8f68b84690787e66c1089ca918079bf60457767 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 11:46:33 -0500 Subject: [PATCH 11/24] update sorting --- .../Search/ExpenseReportListItemRow.tsx | 6 +++++- .../Search/WorkspaceCell.tsx | 17 ++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index c7e9dc315d32..1ffe69b80e63 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -151,7 +151,11 @@ function ExpenseReportListItemRow({ ), [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( - + ), }; diff --git a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx index a99afaef344d..b424999aa45b 100644 --- a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx +++ b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx @@ -2,35 +2,30 @@ import React from 'react'; import {View} from 'react-native'; import Avatar from '@components/Avatar'; import TextWithTooltip from '@components/TextWithTooltip'; -import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; type WorkspaceCellProps = { policyID?: string; + policyName?: string; + avatarURL?: string; }; -function WorkspaceCell({policyID}: WorkspaceCellProps) { +function WorkspaceCell({policyName, avatarURL, policyID}: WorkspaceCellProps) { const styles = useThemeStyles(); - const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true}); - - if (!policyID || !policy) { - return null; - } return ( From c0cf3da6474f1ccaadf81981fda6722cecdddef3 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 11:56:42 -0500 Subject: [PATCH 12/24] fix tests --- tests/unit/Search/SearchUIUtilsTest.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index ae7fcb2156aa..4efadd2950bd 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -2566,13 +2566,14 @@ describe('SearchUIUtils', () => { }); describe('Test getColumnsToShow', () => { - test('Should show all columns when no custom columns are saved & viewing expense reports', () => { + test('Should show all default columns when no custom columns are saved & viewing expense reports', () => { expect(SearchUIUtils.getColumnsToShow(1, [], [], false, CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT)).toEqual({ [CONST.SEARCH.TABLE_COLUMNS.AVATAR]: true, [CONST.SEARCH.TABLE_COLUMNS.DATE]: true, [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: true, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: true, @@ -2589,6 +2590,7 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: false, // Total should always be visible [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, From 06a36c9e4d49194398eb8306f6b402af74f1b4f5 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 12:26:53 -0500 Subject: [PATCH 13/24] fix defaults again --- src/libs/SearchUIUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 15009776a573..b372e2798998 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2554,7 +2554,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, [CONST.SEARCH.TABLE_COLUMNS.TO]: true, - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: true, + [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: true, }; From 4e1d50a6987dc6168aeb55b0a80875c03ce8326c Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 14:12:42 -0500 Subject: [PATCH 14/24] add sorting for workspace --- src/libs/SearchUIUtils.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index b372e2798998..f7889f2f2f2c 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -1962,6 +1962,14 @@ function getSortedTransactionData(data: TransactionListItemType[], localeCompare const sortingProperty = transactionColumnNamesToSortingProperty[sortBy]; + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.WORKSPACE) { + return data.sort((a, b) => { + const aValue = a.policy?.name ?? ''; + const bValue = b.policy?.name ?? ''; + return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); + }); + } + if (!sortingProperty) { return data; } @@ -2012,6 +2020,14 @@ function getSortedReportData(data: TransactionReportGroupListItemType[], localeC }); } + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.WORKSPACE) { + return data.sort((a, b) => { + const aValue = a.policyName; + const bValue = b.policyName; + return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); + }); + } + const sortingProperty = expenseReportColumnNamesToSortingProperty[sortBy]; if (!sortingProperty) { From 23a3c4406330d25261b573a2ce1083a3378407a3 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 14:53:14 -0500 Subject: [PATCH 15/24] update to use policy name --- src/CONST/index.ts | 6 +++--- .../Search/ExpenseReportListItemRow.tsx | 4 ++-- .../SelectionListWithSections/SearchTableHeader.tsx | 4 ++-- src/components/TransactionItemRow/index.tsx | 4 ++-- src/libs/SearchUIUtils.ts | 10 +++++----- src/styles/utils/index.ts | 2 +- tests/unit/Search/SearchUIUtilsTest.ts | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 2b16cd5267fe..ce16d80c4db8 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -6693,7 +6693,7 @@ const CONST = { MERCHANT: this.TABLE_COLUMNS.MERCHANT, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, - WORKSPACE: this.TABLE_COLUMNS.WORKSPACE, + POLICY_NAME: this.TABLE_COLUMNS.POLICY_NAME, CATEGORY: this.TABLE_COLUMNS.CATEGORY, TAG: this.TABLE_COLUMNS.TAG, ACTION: this.TABLE_COLUMNS.ACTION, @@ -6706,7 +6706,7 @@ const CONST = { TITLE: this.TABLE_COLUMNS.TITLE, FROM: this.TABLE_COLUMNS.FROM, TO: this.TABLE_COLUMNS.TO, - WORKSPACE: this.TABLE_COLUMNS.WORKSPACE, + POLICY_NAME: this.TABLE_COLUMNS.POLICY_NAME, ACTION: this.TABLE_COLUMNS.ACTION, }, INVOICE: {}, @@ -6798,7 +6798,7 @@ const CONST = { IN: 'in', COMMENTS: 'comments', CARD: 'card', - WORKSPACE: 'policyname', + POLICY_NAME: 'policyname', WITHDRAWAL_ID: 'withdrawalID', AVATAR: 'avatar', STATUS: 'status', diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index f418c332ed61..cf5057b22105 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -167,8 +167,8 @@ function ExpenseReportListItemRow({ /> ), - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( - + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: ( + [ canBeMissing: true, }, { - columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + columnName: CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME, translationKey: 'workspace.common.workspace', }, { @@ -177,7 +177,7 @@ const getExpenseReportHeaders = (profileIcon?: IconAsset): SearchColumnConfig[] translationKey: 'common.to', }, { - columnName: CONST.SEARCH.TABLE_COLUMNS.WORKSPACE, + columnName: CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME, translationKey: 'workspace.common.workspace', }, { diff --git a/src/components/TransactionItemRow/index.tsx b/src/components/TransactionItemRow/index.tsx index cb5961db20b9..96d2883eaa3b 100644 --- a/src/components/TransactionItemRow/index.tsx +++ b/src/components/TransactionItemRow/index.tsx @@ -408,8 +408,8 @@ function TransactionItemRow({ /> ), - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: ( - + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: ( + ), diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index b875139860ed..8e0bd32f461a 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -1992,7 +1992,7 @@ function getSortedTransactionData(data: TransactionListItemType[], localeCompare const sortingProperty = transactionColumnNamesToSortingProperty[sortBy]; - if (sortBy === CONST.SEARCH.TABLE_COLUMNS.WORKSPACE) { + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { return data.sort((a, b) => { const aValue = a.policy?.name ?? ''; const bValue = b.policy?.name ?? ''; @@ -2050,7 +2050,7 @@ function getSortedReportData(data: TransactionReportGroupListItemType[], localeC }); } - if (sortBy === CONST.SEARCH.TABLE_COLUMNS.WORKSPACE) { + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { return data.sort((a, b) => { const aValue = a.policyName; const bValue = b.policyName; @@ -2215,7 +2215,7 @@ function getSearchColumnTranslationKey(columnId: SearchCustomColumnIds): Transla return 'common.title'; case CONST.SEARCH.TABLE_COLUMNS.STATUS: return 'common.status'; - case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: + case CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME: return 'workspace.common.workspace'; } } @@ -2603,7 +2603,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, [CONST.SEARCH.TABLE_COLUMNS.TO]: true, - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: true, }; @@ -2675,7 +2675,7 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: false, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: false, - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false, [CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: false, [CONST.SEARCH.TABLE_COLUMNS.TAG]: false, [CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: false, diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index be2218359699..ba76dc81061e 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1770,7 +1770,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.ACTION: columnWidth = {...getWidthStyle(variables.w80), ...styles.alignItemsCenter}; break; - case CONST.SEARCH.TABLE_COLUMNS.WORKSPACE: + case CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME: case CONST.SEARCH.TABLE_COLUMNS.MERCHANT: case CONST.SEARCH.TABLE_COLUMNS.FROM: case CONST.SEARCH.TABLE_COLUMNS.TO: diff --git a/tests/unit/Search/SearchUIUtilsTest.ts b/tests/unit/Search/SearchUIUtilsTest.ts index 03e317a53fc8..c1099e90cf9f 100644 --- a/tests/unit/Search/SearchUIUtilsTest.ts +++ b/tests/unit/Search/SearchUIUtilsTest.ts @@ -2728,7 +2728,7 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: true, - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: true, [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, [CONST.SEARCH.TABLE_COLUMNS.ACTION]: true, @@ -2747,7 +2747,7 @@ describe('SearchUIUtils', () => { [CONST.SEARCH.TABLE_COLUMNS.STATUS]: true, [CONST.SEARCH.TABLE_COLUMNS.TITLE]: true, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, - [CONST.SEARCH.TABLE_COLUMNS.WORKSPACE]: false, + [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: false, // Total should always be visible [CONST.SEARCH.TABLE_COLUMNS.TOTAL]: true, From 5e09bee19b010c31c0394a0c0e43d057f2b36b3f Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 16:26:19 -0500 Subject: [PATCH 16/24] add min width --- src/styles/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index 947dcfc7cb50..aa9c1d45b369 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1783,7 +1783,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION: case CONST.SEARCH.TABLE_COLUMNS.IN: default: - columnWidth = styles.flex1; + columnWidth = {...getMinimumWidth(variables.w200), ...styles.flex1}; } return columnWidth; From f1c4b3d490179f9955fbe6126e593e2965cd5c24 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 16:33:38 -0500 Subject: [PATCH 17/24] revert style changes --- src/styles/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/utils/index.ts b/src/styles/utils/index.ts index aa9c1d45b369..947dcfc7cb50 100644 --- a/src/styles/utils/index.ts +++ b/src/styles/utils/index.ts @@ -1783,7 +1783,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({ case CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION: case CONST.SEARCH.TABLE_COLUMNS.IN: default: - columnWidth = {...getMinimumWidth(variables.w200), ...styles.flex1}; + columnWidth = styles.flex1; } return columnWidth; From 475571d8d2a512eb9ce5d89f0b58a6ec06fc1be1 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 17:32:28 -0500 Subject: [PATCH 18/24] update expense policy avatar --- .../Search/WorkspaceCell.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx index b424999aa45b..fffc7421d7ed 100644 --- a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx +++ b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx @@ -2,8 +2,10 @@ import React from 'react'; import {View} from 'react-native'; import Avatar from '@components/Avatar'; import TextWithTooltip from '@components/TextWithTooltip'; +import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; type WorkspaceCellProps = { policyID?: string; @@ -13,19 +15,25 @@ type WorkspaceCellProps = { function WorkspaceCell({policyName, avatarURL, policyID}: WorkspaceCellProps) { const styles = useThemeStyles(); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true}); + + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const name = policyName || policy?.name; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const avatar = avatarURL || policy?.avatarURL; return ( From 8d6fa74e088579e5eaf066a7f4d3f209dbc6ec4a Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Tue, 16 Dec 2025 18:12:35 -0500 Subject: [PATCH 19/24] handle team policies --- .../Search/ExpenseReportListItemRow.tsx | 6 +----- .../Search/WorkspaceCell.tsx | 19 +++++++++---------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index f4c4c9056f27..25d811a2f669 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -169,11 +169,7 @@ function ExpenseReportListItemRow({ ), [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: ( - + ), }; diff --git a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx index fffc7421d7ed..3abb85482f5b 100644 --- a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx +++ b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx @@ -2,25 +2,24 @@ import React from 'react'; import {View} from 'react-native'; import Avatar from '@components/Avatar'; import TextWithTooltip from '@components/TextWithTooltip'; -import useOnyx from '@hooks/useOnyx'; +import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; type WorkspaceCellProps = { policyID?: string; - policyName?: string; - avatarURL?: string; }; -function WorkspaceCell({policyName, avatarURL, policyID}: WorkspaceCellProps) { +function WorkspaceCell({policyID}: WorkspaceCellProps) { const styles = useThemeStyles(); - const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: true}); + const policy = usePolicy(policyID); - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const name = policyName || policy?.name; - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const avatar = avatarURL || policy?.avatarURL; + if (policy?.type === CONST.POLICY.TYPE.PERSONAL || !policy) { + return null; + } + + const name = policy.name; + const avatar = policy.avatarURL; return ( From b7ba841dc0a2d11aaad37ffb27c90758dbbe7123 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 17 Dec 2025 13:21:38 -0500 Subject: [PATCH 20/24] update the workspace cell --- .../Search/ExpenseReportListItemRow.tsx | 5 ++++- .../Search/WorkspaceCell.tsx | 18 +++++++++++------- src/components/TransactionItemRow/index.tsx | 5 ++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx index 45db7c2cd7f8..ee892489fb79 100644 --- a/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx +++ b/src/components/SelectionListWithSections/Search/ExpenseReportListItemRow.tsx @@ -180,7 +180,10 @@ function ExpenseReportListItemRow({ ), [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: ( - + ), }; diff --git a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx index 3abb85482f5b..67bbe48d92df 100644 --- a/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx +++ b/src/components/SelectionListWithSections/Search/WorkspaceCell.tsx @@ -2,31 +2,35 @@ import React from 'react'; import {View} from 'react-native'; import Avatar from '@components/Avatar'; import TextWithTooltip from '@components/TextWithTooltip'; -import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; +import {getPolicyName, getWorkspaceIcon} from '@libs/ReportUtils'; import CONST from '@src/CONST'; +import type {Report} from '@src/types/onyx'; type WorkspaceCellProps = { policyID?: string; + report?: Report; }; -function WorkspaceCell({policyID}: WorkspaceCellProps) { +function WorkspaceCell({policyID, report}: WorkspaceCellProps) { const styles = useThemeStyles(); - const policy = usePolicy(policyID); + const icon = getWorkspaceIcon(report); + const name = getPolicyName({report}); - if (policy?.type === CONST.POLICY.TYPE.PERSONAL || !policy) { + if (report?.type !== CONST.REPORT.TYPE.EXPENSE && report?.type !== CONST.REPORT.TYPE.INVOICE) { return null; } - const name = policy.name; - const avatar = policy.avatarURL; + if (!icon || !name) { + return null; + } return ( - + ), [CONST.SEARCH.TABLE_COLUMNS.TITLE]: ( From 4177deb5b9e0858c68ff8b9cfe8d5820289a1c0c Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 17 Dec 2025 14:19:35 -0500 Subject: [PATCH 21/24] fix sorting for reports --- src/libs/SearchUIUtils.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index caa8507a39e0..cc1a8728470f 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -93,6 +93,7 @@ import { generateReportID, getIcons, getPersonalDetailsForAccountID, + getPolicyName, getReportName, getReportOrDraftReport, getReportStatusTranslation, @@ -2055,8 +2056,8 @@ function getSortedTransactionData( if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { return data.sort((a, b) => { - const aValue = a.policy?.name ?? ''; - const bValue = b.policy?.name ?? ''; + const aValue = getPolicyName({report: a.report}); + const bValue = getPolicyName({report: b.report}); return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); }); } @@ -2154,11 +2155,13 @@ function getSortedReportData( } if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { - return data.sort((a, b) => { - const aValue = a.policyName; - const bValue = b.policyName; - return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); - }); + if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { + return data.sort((a, b) => { + const aValue = getPolicyName({report: a}); + const bValue = getPolicyName({report: b}); + return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); + }); + } } if (sortBy === CONST.SEARCH.TABLE_COLUMNS.REPORT_ID || sortBy === CONST.SEARCH.TABLE_COLUMNS.BASE_62_REPORT_ID) { From 332c6f5f5121f33ee6decf77838f49fa32ec5260 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 17 Dec 2025 14:26:27 -0500 Subject: [PATCH 22/24] fix sorting --- src/libs/SearchUIUtils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index cc1a8728470f..e76832201539 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2056,8 +2056,11 @@ function getSortedTransactionData( if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { return data.sort((a, b) => { - const aValue = getPolicyName({report: a.report}); - const bValue = getPolicyName({report: b.report}); + const aIsReported = a.report?.type !== CONST.REPORT.TYPE.EXPENSE && a.report?.type !== CONST.REPORT.TYPE.INVOICE; + const bIsReported = b.report?.type !== CONST.REPORT.TYPE.EXPENSE && b.report?.type !== CONST.REPORT.TYPE.INVOICE; + + const aValue = aIsReported ? getPolicyName({report: a.report}) : ''; + const bValue = bIsReported ? getPolicyName({report: b.report}) : ''; return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); }); } From f26c34075831ab5fc5dbececcedb1100be8c9923 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 17 Dec 2025 15:06:41 -0500 Subject: [PATCH 23/24] invert sorting conditions --- src/libs/SearchUIUtils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index 8d8859bd1d8a..44e617a17aa4 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2056,11 +2056,11 @@ function getSortedTransactionData( if (sortBy === CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME) { return data.sort((a, b) => { - const aIsReported = a.report?.type !== CONST.REPORT.TYPE.EXPENSE && a.report?.type !== CONST.REPORT.TYPE.INVOICE; - const bIsReported = b.report?.type !== CONST.REPORT.TYPE.EXPENSE && b.report?.type !== CONST.REPORT.TYPE.INVOICE; + const aIsUnreported = a.report?.type !== CONST.REPORT.TYPE.EXPENSE && a.report?.type !== CONST.REPORT.TYPE.INVOICE; + const bIsUnreported = b.report?.type !== CONST.REPORT.TYPE.EXPENSE && b.report?.type !== CONST.REPORT.TYPE.INVOICE; - const aValue = aIsReported ? getPolicyName({report: a.report}) : ''; - const bValue = bIsReported ? getPolicyName({report: b.report}) : ''; + const aValue = !aIsUnreported ? getPolicyName({report: a.report}) : ''; + const bValue = !bIsUnreported ? getPolicyName({report: b.report}) : ''; return compareValues(aValue, bValue, sortOrder, sortBy, localeCompare); }); } From a74ba44389886b65bc8c247744f2d0d809ff0803 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 17 Dec 2025 16:45:45 -0500 Subject: [PATCH 24/24] fix merge conflict errs --- src/libs/SearchUIUtils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/SearchUIUtils.ts b/src/libs/SearchUIUtils.ts index c53bd0c7446a..48a8352f0465 100644 --- a/src/libs/SearchUIUtils.ts +++ b/src/libs/SearchUIUtils.ts @@ -2858,8 +2858,11 @@ function getColumnsToShow( [CONST.SEARCH.TABLE_COLUMNS.DESCRIPTION]: false, [CONST.SEARCH.TABLE_COLUMNS.FROM]: false, [CONST.SEARCH.TABLE_COLUMNS.TO]: false, + [CONST.SEARCH.TABLE_COLUMNS.CARD]: false, [CONST.SEARCH.TABLE_COLUMNS.POLICY_NAME]: false, + [CONST.SEARCH.TABLE_COLUMNS.CATEGORY]: false, [CONST.SEARCH.TABLE_COLUMNS.TAG]: false, + [CONST.SEARCH.TABLE_COLUMNS.REIMBURSABLE]: false, [CONST.SEARCH.TABLE_COLUMNS.BILLABLE]: false, [CONST.SEARCH.TABLE_COLUMNS.TAX_RATE]: false, [CONST.SEARCH.TABLE_COLUMNS.TAX_AMOUNT]: false,