From 8805e34de7d1b64d93c970ad8e8b93f0d3bfc5ad Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 12:16:46 +0200 Subject: [PATCH 01/10] Remove RBR from Preview header --- .../MoneyRequestReportPreviewContent.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index da1deb61be0a..27effebd385b 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -522,17 +522,6 @@ function MoneyRequestReportPreviewContent({ )} - {shouldShowRBR && ( - - - - {translate('violations.reviewRequired')} - - - )} Date: Tue, 8 Apr 2025 12:23:47 +0200 Subject: [PATCH 02/10] Fix Report Preview in Self-DM & display of single expenses in threads --- .../MoneyRequestReportPreviewContent.tsx | 6 ++++- .../MoneyRequestReportPreview/index.tsx | 13 ++++++++-- .../MoneyRequestReportPreview/types.ts | 3 +++ src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ .../home/report/PureReportActionItem.tsx | 25 ++++++++++++++++--- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 27effebd385b..8c6927b0b993 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -107,6 +107,7 @@ function MoneyRequestReportPreviewContent({ renderItem, getCurrentWidth, reportPreviewStyles, + isSelfDM, }: MoneyRequestReportPreviewContentProps) { const lastTransaction = transactions?.at(0); const transactionIDList = transactions?.map((reportTransaction) => reportTransaction.transactionID) ?? []; @@ -415,6 +416,9 @@ function MoneyRequestReportPreviewContent({ // The button should expand up to transaction width const buttonMaxWidth = !shouldUseNarrowLayout ? {maxWidth: reportPreviewStyles.transactionPreviewStyle.width} : {}; + // If preview is inside Self-DM it has only 1 transaction + const firstTransaction = transactions.at(0); + const approvedOrSettledicon = (iouSettled || isApproved) && ( - {action.childReportName} + {isSelfDM && firstTransaction ? translate('iou.selfDMTrackReportName', firstTransaction) : action.childReportName} {!doesReportNameOverflow && <> {approvedOrSettledicon}} diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index 27a812502640..37a6c3cde2e8 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -9,7 +9,13 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useTransactionViolations from '@hooks/useTransactionViolations'; -import {getIOUActionForReportID, isSplitBillAction as isSplitBillActionReportActionsUtils, isTrackExpenseAction as isTrackExpenseActionReportActionsUtils} from '@libs/ReportActionsUtils'; +import { + getIOUActionForReportID, + getLinkedTransactionID, + isSplitBillAction as isSplitBillActionReportActionsUtils, + isTrackExpenseAction as isTrackExpenseActionReportActionsUtils, +} from '@libs/ReportActionsUtils'; +import {getTransaction} from '@libs/TransactionUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Transaction} from '@src/types/onyx'; @@ -28,6 +34,7 @@ function MoneyRequestReportPreview({ checkIfContextMenuActive = () => {}, onPaymentOptionsShow, onPaymentOptionsHide, + isSelfDM = false, }: MoneyRequestReportPreviewProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -40,7 +47,8 @@ function MoneyRequestReportPreview({ selector: (personalDetails) => personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID], }); - const [iouReport, transactions, violations] = useReportWithTransactionsAndViolations(iouReportID); + const [iouReport, transactionsFromReport, violations] = useReportWithTransactionsAndViolations(iouReportID); + const transactions = isSelfDM ? ([getTransaction(getLinkedTransactionID(action))].filter((t) => t) as Transaction[]) : transactionsFromReport; const policy = usePolicy(policyID); const lastTransaction = transactions?.at(0); const lastTransactionViolations = useTransactionViolations(lastTransaction?.transactionID); @@ -98,6 +106,7 @@ function MoneyRequestReportPreview({ setCurrentWidth(e.nativeEvent.layout.width ?? 255); }} reportPreviewStyles={reportPreviewStyles} + isSelfDM={isSelfDM} /> ); } diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index c502df223adc..dc9840f5bcd1 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -45,6 +45,9 @@ type MoneyRequestReportPreviewProps = { /** Whether the corresponding report action item is hovered */ isHovered?: boolean; + + /** Whether the preview is inside Self-DM chat */ + isSelfDM?: boolean; }; type MoneyRequestReportPreviewContentOnyxProps = { diff --git a/src/languages/en.ts b/src/languages/en.ts index 2fe87a5fbd60..d9d503304e38 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2,6 +2,7 @@ import {CONST as COMMON_CONST} from 'expensify-common'; import startCase from 'lodash/startCase'; import CONST from '@src/CONST'; import type {Country} from '@src/CONST'; +import type {Transaction} from '@src/types/onyx'; import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, @@ -1043,6 +1044,7 @@ const translations = { `changed the ${translatedChangedField} to ${newMerchant} (previously ${oldMerchant}), which updated the amount to ${newAmountToDisplay} (previously ${oldAmountToDisplay})`, threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} ${comment ? `for ${comment}` : 'expense'}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Tracking ${formattedAmount} ${comment ? `for ${comment}` : ''}`, + selfDMTrackReportName: ({transactionID}: Transaction) => `Track Expense #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} sent${comment ? ` for ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `moved expense from personal space to ${workspaceName ?? `chat with ${reportName}`}`, movedToPersonalSpace: 'moved expense to personal space', diff --git a/src/languages/es.ts b/src/languages/es.ts index 2bc4d7404bfb..a93d199c85bd 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1,5 +1,6 @@ import {CONST as COMMON_CONST} from 'expensify-common'; import CONST from '@src/CONST'; +import type {Transaction} from '@src/types/onyx'; import type en from './en'; import type { AccountOwnerParams, @@ -1041,6 +1042,7 @@ const translations = { `cambió la ${translatedChangedField} a ${newMerchant} (previamente ${oldMerchant}), lo que cambió el importe a ${newAmountToDisplay} (previamente ${oldAmountToDisplay})`, threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${comment ? `${formattedAmount} para ${comment}` : `Gasto de ${formattedAmount}`}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Seguimiento ${formattedAmount} ${comment ? `para ${comment}` : ''}`, + selfDMTrackReportName: ({transactionID}: Transaction) => `Seguimiento de gastos #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} enviado${comment ? ` para ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `movió el gasto desde su espacio personal a ${workspaceName ?? `un chat con ${reportName}`}`, movedToPersonalSpace: 'movió el gasto a su espacio personal', diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 2d1bb46aa64f..98ab07582937 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -770,9 +770,28 @@ function PureReportActionItem({ /> ); - // Table Report View does not display these components as separate messages - if (canUseTableReportView) { - children = emptyHTML; + // Table Report View does not display these components as separate messages, except for self-DM + if (canUseTableReportView && report?.type === 'chat') { + if (report.chatType === 'selfDM') { + children = ( + setIsPaymentMethodPopoverActive(true)} + onPaymentOptionsHide={() => setIsPaymentMethodPopoverActive(false)} + /> + ); + } else { + children = emptyHTML; + } } } else if (isTripPreview(action)) { children = ( From 53e3e21a66e59760883f52548cf3d3dd0e6dbc86 Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 14:00:34 +0200 Subject: [PATCH 03/10] Fix invoices --- .../MoneyRequestReportPreviewContent.tsx | 21 +++++++++++++++---- .../MoneyRequestReportPreview/index.tsx | 2 ++ .../MoneyRequestReportPreview/types.ts | 3 +++ src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ .../home/report/PureReportActionItem.tsx | 1 + 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index 8c6927b0b993..dc9805531770 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -29,6 +29,7 @@ import ControlSelection from '@libs/ControlSelection'; import {convertToDisplayString} from '@libs/CurrencyUtils'; import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import {getConnectedIntegration} from '@libs/PolicyUtils'; +import {getOriginalMessage, isActionOfType} from '@libs/ReportActionsUtils'; import { areAllRequestsBeingSmartScanned as areAllRequestsBeingSmartScannedReportUtils, canBeExported, @@ -108,6 +109,7 @@ function MoneyRequestReportPreviewContent({ getCurrentWidth, reportPreviewStyles, isSelfDM, + isInvoice, }: MoneyRequestReportPreviewContentProps) { const lastTransaction = transactions?.at(0); const transactionIDList = transactions?.map((reportTransaction) => reportTransaction.transactionID) ?? []; @@ -416,9 +418,6 @@ function MoneyRequestReportPreviewContent({ // The button should expand up to transaction width const buttonMaxWidth = !shouldUseNarrowLayout ? {maxWidth: reportPreviewStyles.transactionPreviewStyle.width} : {}; - // If preview is inside Self-DM it has only 1 transaction - const firstTransaction = transactions.at(0); - const approvedOrSettledicon = (iouSettled || isApproved) && ( ); + const getPreviewName = () => { + // If preview is inside Self-DM it has only 1 transaction + const firstTransaction = transactions.at(0); + const originalMessage = isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) ? getOriginalMessage(action) : undefined; + + if (isInvoice && !!originalMessage) { + return translate('iou.invoiceReportName', originalMessage); + } + if (isSelfDM && firstTransaction) { + return translate('iou.selfDMTrackReportName', firstTransaction); + } + return action.childReportName; + }; + return ( transactions.length > 0 && ( - {isSelfDM && firstTransaction ? translate('iou.selfDMTrackReportName', firstTransaction) : action.childReportName} + {getPreviewName()} {!doesReportNameOverflow && <> {approvedOrSettledicon}} diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index 37a6c3cde2e8..8c5ed0441d47 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -35,6 +35,7 @@ function MoneyRequestReportPreview({ onPaymentOptionsShow, onPaymentOptionsHide, isSelfDM = false, + isInvoice = false, }: MoneyRequestReportPreviewProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -107,6 +108,7 @@ function MoneyRequestReportPreview({ }} reportPreviewStyles={reportPreviewStyles} isSelfDM={isSelfDM} + isInvoice={isInvoice} /> ); } diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index dc9840f5bcd1..475f653eed92 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -48,6 +48,9 @@ type MoneyRequestReportPreviewProps = { /** Whether the preview is inside Self-DM chat */ isSelfDM?: boolean; + + /** Whether it is an invoice preview */ + isInvoice?: boolean; }; type MoneyRequestReportPreviewContentOnyxProps = { diff --git a/src/languages/en.ts b/src/languages/en.ts index d9d503304e38..a15e072710a6 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3,6 +3,7 @@ import startCase from 'lodash/startCase'; import CONST from '@src/CONST'; import type {Country} from '@src/CONST'; import type {Transaction} from '@src/types/onyx'; +import type OriginalMessage from '@src/types/onyx/OriginalMessage'; import type { AccountOwnerParams, ActionsAreCurrentlyRestricted, @@ -1044,6 +1045,7 @@ const translations = { `changed the ${translatedChangedField} to ${newMerchant} (previously ${oldMerchant}), which updated the amount to ${newAmountToDisplay} (previously ${oldAmountToDisplay})`, threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} ${comment ? `for ${comment}` : 'expense'}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Tracking ${formattedAmount} ${comment ? `for ${comment}` : ''}`, + invoiceReportName: ({linkedReportID}: OriginalMessage) => `Invoice Report #${linkedReportID}`, selfDMTrackReportName: ({transactionID}: Transaction) => `Track Expense #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} sent${comment ? ` for ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `moved expense from personal space to ${workspaceName ?? `chat with ${reportName}`}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index a93d199c85bd..2d2a635ddb9b 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1,6 +1,7 @@ import {CONST as COMMON_CONST} from 'expensify-common'; import CONST from '@src/CONST'; import type {Transaction} from '@src/types/onyx'; +import type OriginalMessage from '@src/types/onyx/OriginalMessage'; import type en from './en'; import type { AccountOwnerParams, @@ -1042,6 +1043,7 @@ const translations = { `cambió la ${translatedChangedField} a ${newMerchant} (previamente ${oldMerchant}), lo que cambió el importe a ${newAmountToDisplay} (previamente ${oldAmountToDisplay})`, threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${comment ? `${formattedAmount} para ${comment}` : `Gasto de ${formattedAmount}`}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Seguimiento ${formattedAmount} ${comment ? `para ${comment}` : ''}`, + invoiceReportName: ({linkedReportID}: OriginalMessage) => `Informe de facturación #${linkedReportID}`, selfDMTrackReportName: ({transactionID}: Transaction) => `Seguimiento de gastos #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} enviado${comment ? ` para ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `movió el gasto desde su espacio personal a ${workspaceName ?? `un chat con ${reportName}`}`, diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 98ab07582937..b9a575770cd7 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -817,6 +817,7 @@ function PureReportActionItem({ contextMenuAnchor={popoverAnchorRef.current} isHovered={hovered} isWhisper={isWhisper} + isInvoice={action.childType === 'invoice'} checkIfContextMenuActive={toggleContextMenuFromActiveReportAction} onPaymentOptionsShow={() => setIsPaymentMethodPopoverActive(true)} onPaymentOptionsHide={() => setIsPaymentMethodPopoverActive(false)} From 8ec824486fa59877a9a9f614f41cc5ec7af3f8ed Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 14:19:32 +0200 Subject: [PATCH 04/10] Clean-up --- .../ReportActionItem/MoneyRequestReportPreview/index.tsx | 3 ++- src/pages/home/report/PureReportActionItem.tsx | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index 8c5ed0441d47..a6ba2f6bac33 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -49,7 +49,8 @@ function MoneyRequestReportPreview({ personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID], }); const [iouReport, transactionsFromReport, violations] = useReportWithTransactionsAndViolations(iouReportID); - const transactions = isSelfDM ? ([getTransaction(getLinkedTransactionID(action))].filter((t) => t) as Transaction[]) : transactionsFromReport; + const linkedTransaction = getTransaction(getLinkedTransactionID(action)); + const transactions = !isSelfDM || !linkedTransaction ? transactionsFromReport : [linkedTransaction]; const policy = usePolicy(policyID); const lastTransaction = transactions?.at(0); const lastTransactionViolations = useTransactionViolations(lastTransaction?.transactionID); diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index b9a575770cd7..8e758ea15e8d 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -771,8 +771,8 @@ function PureReportActionItem({ ); // Table Report View does not display these components as separate messages, except for self-DM - if (canUseTableReportView && report?.type === 'chat') { - if (report.chatType === 'selfDM') { + if (canUseTableReportView && report?.type === CONST.REPORT.TYPE.CHAT) { + if (report.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM) { children = ( setIsPaymentMethodPopoverActive(true)} onPaymentOptionsHide={() => setIsPaymentMethodPopoverActive(false)} From b535d43a8bd6d7668c65a186e1d45e759da3155a Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 14:41:51 +0200 Subject: [PATCH 05/10] Make self-dm expenses not a preview --- .../MoneyRequestReportPreviewContent.tsx | 6 ---- .../MoneyRequestReportPreview/index.tsx | 14 ++------ .../MoneyRequestReportPreview/types.ts | 3 -- .../home/report/PureReportActionItem.tsx | 32 +++++++++++-------- 4 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index dc9805531770..fcc023e63f42 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -108,7 +108,6 @@ function MoneyRequestReportPreviewContent({ renderItem, getCurrentWidth, reportPreviewStyles, - isSelfDM, isInvoice, }: MoneyRequestReportPreviewContentProps) { const lastTransaction = transactions?.at(0); @@ -430,16 +429,11 @@ function MoneyRequestReportPreviewContent({ ); const getPreviewName = () => { - // If preview is inside Self-DM it has only 1 transaction - const firstTransaction = transactions.at(0); const originalMessage = isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) ? getOriginalMessage(action) : undefined; if (isInvoice && !!originalMessage) { return translate('iou.invoiceReportName', originalMessage); } - if (isSelfDM && firstTransaction) { - return translate('iou.selfDMTrackReportName', firstTransaction); - } return action.childReportName; }; diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index a6ba2f6bac33..e621a0655b53 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -9,13 +9,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useTransactionViolations from '@hooks/useTransactionViolations'; -import { - getIOUActionForReportID, - getLinkedTransactionID, - isSplitBillAction as isSplitBillActionReportActionsUtils, - isTrackExpenseAction as isTrackExpenseActionReportActionsUtils, -} from '@libs/ReportActionsUtils'; -import {getTransaction} from '@libs/TransactionUtils'; +import {getIOUActionForReportID, isSplitBillAction as isSplitBillActionReportActionsUtils, isTrackExpenseAction as isTrackExpenseActionReportActionsUtils} from '@libs/ReportActionsUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Transaction} from '@src/types/onyx'; @@ -34,7 +28,6 @@ function MoneyRequestReportPreview({ checkIfContextMenuActive = () => {}, onPaymentOptionsShow, onPaymentOptionsHide, - isSelfDM = false, isInvoice = false, }: MoneyRequestReportPreviewProps) { const styles = useThemeStyles(); @@ -48,9 +41,7 @@ function MoneyRequestReportPreview({ selector: (personalDetails) => personalDetails?.[chatReport?.invoiceReceiver && 'accountID' in chatReport.invoiceReceiver ? chatReport.invoiceReceiver.accountID : CONST.DEFAULT_NUMBER_ID], }); - const [iouReport, transactionsFromReport, violations] = useReportWithTransactionsAndViolations(iouReportID); - const linkedTransaction = getTransaction(getLinkedTransactionID(action)); - const transactions = !isSelfDM || !linkedTransaction ? transactionsFromReport : [linkedTransaction]; + const [iouReport, transactions, violations] = useReportWithTransactionsAndViolations(iouReportID); const policy = usePolicy(policyID); const lastTransaction = transactions?.at(0); const lastTransactionViolations = useTransactionViolations(lastTransaction?.transactionID); @@ -108,7 +99,6 @@ function MoneyRequestReportPreview({ setCurrentWidth(e.nativeEvent.layout.width ?? 255); }} reportPreviewStyles={reportPreviewStyles} - isSelfDM={isSelfDM} isInvoice={isInvoice} /> ); diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index 475f653eed92..8d994fb11b79 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -46,9 +46,6 @@ type MoneyRequestReportPreviewProps = { /** Whether the corresponding report action item is hovered */ isHovered?: boolean; - /** Whether the preview is inside Self-DM chat */ - isSelfDM?: boolean; - /** Whether it is an invoice preview */ isInvoice?: boolean; }; diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 8e758ea15e8d..cd297d984bed 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -30,6 +30,7 @@ import MoneyRequestReportPreview from '@components/ReportActionItem/MoneyRequest import ReportPreview from '@components/ReportActionItem/ReportPreview'; import TaskAction from '@components/ReportActionItem/TaskAction'; import TaskPreview from '@components/ReportActionItem/TaskPreview'; +import TransactionPreview from '@components/ReportActionItem/TransactionPreview'; import TripRoomPreview from '@components/ReportActionItem/TripRoomPreview'; import {ShowContextMenuContext} from '@components/ShowContextMenuContext'; import Text from '@components/Text'; @@ -97,8 +98,10 @@ import { isReimbursementDeQueuedOrCanceledAction, isReimbursementQueuedAction, isRenamedAction, + isSplitBillAction as isSplitBillActionReportActionsUtils, isTagModificationAction, isTaskAction, + isTrackExpenseAction as isTrackExpenseActionReportActionsUtils, isTripPreview, isUnapprovedAction, isWhisperActionTargetedToOthers, @@ -420,6 +423,8 @@ function PureReportActionItem({ [StyleUtils, isReportActionLinked, theme.messageHighlightBG], ); + const reportPreviewStyles = StyleUtils.getMoneyRequestReportPreviewStyle(shouldUseNarrowLayout, undefined, true); + const isDeletedParentAction = isDeletedParentActionUtils(action); // IOUDetails only exists when we are sending money @@ -774,20 +779,19 @@ function PureReportActionItem({ if (canUseTableReportView && report?.type === CONST.REPORT.TYPE.CHAT) { if (report.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM) { children = ( - setIsPaymentMethodPopoverActive(true)} - onPaymentOptionsHide={() => setIsPaymentMethodPopoverActive(false)} - /> + + {}} + isTrackExpense={isTrackExpenseActionReportActionsUtils(action)} + /> + ); } else { children = emptyHTML; From 999bb2a56cdd47970d2094cd8ce9a9ec6a56b7a9 Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 14:54:41 +0200 Subject: [PATCH 06/10] Remove unused function from languages --- src/languages/en.ts | 2 -- src/languages/es.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index a15e072710a6..945c02efba98 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2,7 +2,6 @@ import {CONST as COMMON_CONST} from 'expensify-common'; import startCase from 'lodash/startCase'; import CONST from '@src/CONST'; import type {Country} from '@src/CONST'; -import type {Transaction} from '@src/types/onyx'; import type OriginalMessage from '@src/types/onyx/OriginalMessage'; import type { AccountOwnerParams, @@ -1046,7 +1045,6 @@ const translations = { threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${formattedAmount} ${comment ? `for ${comment}` : 'expense'}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Tracking ${formattedAmount} ${comment ? `for ${comment}` : ''}`, invoiceReportName: ({linkedReportID}: OriginalMessage) => `Invoice Report #${linkedReportID}`, - selfDMTrackReportName: ({transactionID}: Transaction) => `Track Expense #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} sent${comment ? ` for ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `moved expense from personal space to ${workspaceName ?? `chat with ${reportName}`}`, movedToPersonalSpace: 'moved expense to personal space', diff --git a/src/languages/es.ts b/src/languages/es.ts index 2d2a635ddb9b..4e06b7019a62 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1,6 +1,5 @@ import {CONST as COMMON_CONST} from 'expensify-common'; import CONST from '@src/CONST'; -import type {Transaction} from '@src/types/onyx'; import type OriginalMessage from '@src/types/onyx/OriginalMessage'; import type en from './en'; import type { @@ -1044,7 +1043,6 @@ const translations = { threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${comment ? `${formattedAmount} para ${comment}` : `Gasto de ${formattedAmount}`}`, threadTrackReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `Seguimiento ${formattedAmount} ${comment ? `para ${comment}` : ''}`, invoiceReportName: ({linkedReportID}: OriginalMessage) => `Informe de facturación #${linkedReportID}`, - selfDMTrackReportName: ({transactionID}: Transaction) => `Seguimiento de gastos #${transactionID}`, threadPaySomeoneReportName: ({formattedAmount, comment}: ThreadSentMoneyReportNameParams) => `${formattedAmount} enviado${comment ? ` para ${comment}` : ''}`, movedFromPersonalSpace: ({workspaceName, reportName}: MovedFromPersonalSpaceParams) => `movió el gasto desde su espacio personal a ${workspaceName ?? `un chat con ${reportName}`}`, movedToPersonalSpace: 'movió el gasto a su espacio personal', From 84217298061ecdc2b3cae183088d4bc8fcf4614e Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 15:06:26 +0200 Subject: [PATCH 07/10] Fix self-DM expense width on narrow layout --- src/components/ReportActionItem/TransactionPreview/types.ts | 2 +- src/pages/home/report/PureReportActionItem.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/TransactionPreview/types.ts b/src/components/ReportActionItem/TransactionPreview/types.ts index d8239c66f372..208b12478c6f 100644 --- a/src/components/ReportActionItem/TransactionPreview/types.ts +++ b/src/components/ReportActionItem/TransactionPreview/types.ts @@ -5,7 +5,7 @@ import type {PersonalDetailsList, Report, ReportAction, Transaction, Transaction import type {Errors} from '@src/types/onyx/OnyxCommon'; type TransactionPreviewStyleType = { - width: number; + width: number | string; maxWidth?: number; }; diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index cd297d984bed..27130a9fa167 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -787,7 +787,7 @@ function PureReportActionItem({ reportID={reportID} action={action} isBillSplit={isSplitBillActionReportActionsUtils(action)} - wrapperStyles={reportPreviewStyles.transactionPreviewStyle} + wrapperStyles={shouldUseNarrowLayout ? styles.w100 : reportPreviewStyles.transactionPreviewStyle} onPreviewPressed={() => {}} isTrackExpense={isTrackExpenseActionReportActionsUtils(action)} /> From 43a2ffa91be57a9057a7119d64485058e0050761 Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Tue, 8 Apr 2025 18:50:10 +0200 Subject: [PATCH 08/10] Fix typescript issues, skeleton & test --- .../MoneyRequestReportPreview/types.ts | 6 +- .../TransactionPreview/types.ts | 2 +- .../TransactionPreviewSkeletonView.tsx | 87 +++++++++++-------- .../home/report/PureReportActionItem.tsx | 4 +- src/styles/index.ts | 4 + tests/ui/MoneyRequestReportPreview.test.tsx | 3 +- 6 files changed, 65 insertions(+), 41 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index 8d994fb11b79..d1c3eab05a63 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -4,11 +4,15 @@ import type {TransactionPreviewStyleType} from '@components/ReportActionItem/Tra import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActionContextMenu'; import type {PersonalDetails, Policy, Report, ReportAction, Transaction, TransactionViolation, TransactionViolations} from '@src/types/onyx'; +type TransactionPreviewStyle = { + [key in keyof TransactionPreviewStyleType]: number; +}; + type MoneyRequestReportPreviewStyleType = { flatListStyle: StyleProp; wrapperStyle: ViewStyle; contentContainerStyle: ViewStyle; - transactionPreviewStyle: TransactionPreviewStyleType; + transactionPreviewStyle: TransactionPreviewStyle; componentStyle: StyleProp; }; diff --git a/src/components/ReportActionItem/TransactionPreview/types.ts b/src/components/ReportActionItem/TransactionPreview/types.ts index 208b12478c6f..8c1d2b2eb199 100644 --- a/src/components/ReportActionItem/TransactionPreview/types.ts +++ b/src/components/ReportActionItem/TransactionPreview/types.ts @@ -6,7 +6,7 @@ import type {Errors} from '@src/types/onyx/OnyxCommon'; type TransactionPreviewStyleType = { width: number | string; - maxWidth?: number; + maxWidth?: number | string; }; type TransactionPreviewProps = { diff --git a/src/components/TransactionPreviewSkeletonView.tsx b/src/components/TransactionPreviewSkeletonView.tsx index 959e7e8f0ca7..d8bbe784ae02 100644 --- a/src/components/TransactionPreviewSkeletonView.tsx +++ b/src/components/TransactionPreviewSkeletonView.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import {View} from 'react-native'; import {Rect} from 'react-native-svg'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -6,52 +7,66 @@ import variables from '@styles/variables'; import SkeletonViewContentLoader from './SkeletonViewContentLoader'; type TransactionPreviewSkeletonViewProps = { - transactionPreviewWidth: number; + transactionPreviewWidth: number | string; }; function TransactionPreviewSkeletonView({transactionPreviewWidth}: TransactionPreviewSkeletonViewProps) { const theme = useTheme(); const styles = useThemeStyles(); + const isWidthANumber = typeof transactionPreviewWidth === 'number'; const {width, height} = { - width: transactionPreviewWidth - styles.p4.padding * 2, + width: isWidthANumber ? transactionPreviewWidth - styles.p4.padding * 2 : transactionPreviewWidth, height: variables.transactionPreviewSkeletonHeight, }; return ( - - - - - - + + + + + + + {/* This skeleton inverts the progress bar, which should be on the right, + so we don't need to know the width of the component to calculate it - works with percentages. + */} + + + + + + ); } diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 27130a9fa167..fd761d1cc727 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -779,7 +779,7 @@ function PureReportActionItem({ if (canUseTableReportView && report?.type === CONST.REPORT.TYPE.CHAT) { if (report.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM) { children = ( - + {}} isTrackExpense={isTrackExpenseActionReportActionsUtils(action)} /> diff --git a/src/styles/index.ts b/src/styles/index.ts index 18cf3486a61f..c31390a8eb46 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -3155,6 +3155,10 @@ const styles = (theme: ThemeColors) => transform: `rotate(180deg)`, }, + mirror: { + transform: `scaleX(-1)`, + }, + navigationScreenCardStyle: { backgroundColor: theme.appBG, height: '100%', diff --git a/tests/ui/MoneyRequestReportPreview.test.tsx b/tests/ui/MoneyRequestReportPreview.test.tsx index e94c113c2ebc..925dc3d64f4b 100644 --- a/tests/ui/MoneyRequestReportPreview.test.tsx +++ b/tests/ui/MoneyRequestReportPreview.test.tsx @@ -112,6 +112,7 @@ const mockOnyxTransactions: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION}${s const mockOnyxViolations: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${string}`, TransactionViolations> = { [`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${mockTransaction.transactionID}`]: mockViolations, + [`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${mockSecondTransaction.transactionID}`]: mockViolations, }; const arrayOfTransactions = Object.values(mockOnyxTransactions); @@ -150,7 +151,7 @@ describe('MoneyRequestReportPreview', () => { } }); - it('renders RBR for both transaction and report if there are violations', async () => { + it('renders RBR for every transaction with violations', async () => { renderPage({}); await waitForBatchedUpdatesWithAct(); await Onyx.multiSet({...mockOnyxTransactions, ...mockOnyxViolations}); From 240a027ffb8bba5d5b1e4b9a488b21e024354f69 Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Thu, 10 Apr 2025 09:26:57 +0200 Subject: [PATCH 09/10] Address allgandalf PR comments --- .../MoneyRequestReportPreviewContent.tsx | 7 +++---- .../MoneyRequestReportPreview/index.tsx | 3 +-- .../MoneyRequestReportPreview/types.ts | 2 +- .../TransactionPreview/TransactionPreviewContent.tsx | 6 +++--- .../ReportActionItem/TransactionPreview/types.ts | 9 +++++---- src/pages/home/report/PureReportActionItem.tsx | 11 ++++------- src/stories/MoneyRequestReportPreview.stories.tsx | 3 +-- src/stories/TransactionPreviewContent.stories.tsx | 2 +- 8 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx index fcc023e63f42..50fe364cf8a0 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx @@ -429,10 +429,9 @@ function MoneyRequestReportPreviewContent({ ); const getPreviewName = () => { - const originalMessage = isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW) ? getOriginalMessage(action) : undefined; - - if (isInvoice && !!originalMessage) { - return translate('iou.invoiceReportName', originalMessage); + if (isInvoice && isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW)) { + const originalMessage = getOriginalMessage(action); + return originalMessage && translate('iou.invoiceReportName', originalMessage); } return action.childReportName; }; diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index e621a0655b53..b100e1edce70 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -65,8 +65,7 @@ function MoneyRequestReportPreview({ isWhisper={isWhisper} isHovered={isHovered} iouReportID={iouReportID} - onPreviewPressed={() => {}} - wrapperStyles={reportPreviewStyles.transactionPreviewStyle} + wrapperStyle={reportPreviewStyles.transactionPreviewStyle} containerStyles={[styles.h100, containerStyles]} transactionID={item.transactionID} /> diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts index d1c3eab05a63..4d002e04f38d 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/types.ts @@ -50,7 +50,7 @@ type MoneyRequestReportPreviewProps = { /** Whether the corresponding report action item is hovered */ isHovered?: boolean; - /** Whether it is an invoice preview */ + /** Whether the report is an invoice preview */ isInvoice?: boolean; }; diff --git a/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx b/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx index 0b79f75f9cbc..8859698fec95 100644 --- a/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx +++ b/src/components/ReportActionItem/TransactionPreview/TransactionPreviewContent.tsx @@ -49,7 +49,7 @@ function TransactionPreviewContent({ navigateToReviewFields, onPreviewPressed, containerStyles, - wrapperStyles, + wrapperStyle, isBillSplit, areThereDuplicates, sessionAccountID, @@ -205,7 +205,7 @@ function TransactionPreviewContent({ /> )} {shouldShowSkeleton ? ( - + ) : ( @@ -370,7 +370,7 @@ function TransactionPreviewContent({ accessibilityHint={convertToDisplayString(requestAmount, requestCurrency)} style={[ styles.moneyRequestPreviewBox, - wrapperStyles, + wrapperStyle, themeStyles, shouldDisableOnPress && styles.cursorDefault, (isIOUSettled || isApproved) && isSettlementOrApprovalPartial && styles.offlineFeedback.pending, diff --git a/src/components/ReportActionItem/TransactionPreview/types.ts b/src/components/ReportActionItem/TransactionPreview/types.ts index 8c1d2b2eb199..b785a1892b59 100644 --- a/src/components/ReportActionItem/TransactionPreview/types.ts +++ b/src/components/ReportActionItem/TransactionPreview/types.ts @@ -4,6 +4,7 @@ import type {ContextMenuAnchor} from '@pages/home/report/ContextMenu/ReportActio import type {PersonalDetailsList, Report, ReportAction, Transaction, TransactionViolations} from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; +// string type union is here for percentage values type TransactionPreviewStyleType = { width: number | string; maxWidth?: number | string; @@ -20,7 +21,7 @@ type TransactionPreviewProps = { reportID: string | undefined; /** Callback for the preview pressed */ - onPreviewPressed: (event?: GestureResponderEvent | KeyboardEvent) => void; + onPreviewPressed?: (event?: GestureResponderEvent | KeyboardEvent) => void; /** All the data of the action, used for showing context menu */ action: OnyxEntry; @@ -35,7 +36,7 @@ type TransactionPreviewProps = { containerStyles?: StyleProp; /** Optional custom styles to be applied to wrapper component. */ - wrapperStyles: TransactionPreviewStyleType; + wrapperStyle: TransactionPreviewStyleType; /** True if this IOU has a type of split */ isBillSplit: boolean; @@ -72,7 +73,7 @@ type TransactionPreviewContentProps = { navigateToReviewFields: () => void; /** General callback for handling presses on the preview component, can also handle keyboard events. */ - onPreviewPressed: (event?: GestureResponderEvent | KeyboardEvent | undefined) => void; + onPreviewPressed?: (event?: GestureResponderEvent | KeyboardEvent | undefined) => void; /** Whether the transaction is whisper. */ isWhisper?: boolean; @@ -84,7 +85,7 @@ type TransactionPreviewContentProps = { containerStyles?: StyleProp; /** Optional custom styles to be applied to wrapper component. */ - wrapperStyles: TransactionPreviewStyleType; + wrapperStyle: TransactionPreviewStyleType; /** Records any errors related to wallet terms. */ walletTermsErrors: Errors | undefined; diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index fd761d1cc727..e19540359d87 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -781,13 +781,12 @@ function PureReportActionItem({ children = ( {}} isTrackExpense={isTrackExpenseActionReportActionsUtils(action)} /> @@ -813,8 +812,7 @@ function PureReportActionItem({ } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && canUseTableReportView) { children = ( = ({item}) => ( showContextMenu={() => undefined} offlineWithFeedbackOnClose={() => undefined} navigateToReviewFields={() => undefined} - onPreviewPressed={() => true} isBillSplit={false} areThereDuplicates={false} sessionAccountID={11111111} walletTermsErrors={undefined} routeName={SCREENS.TRANSACTION_DUPLICATE.REVIEW} shouldHideOnDelete={false} - wrapperStyles={style.transactionPreviewStyle} + wrapperStyle={style.transactionPreviewStyle} containerStyles={[sizing.h100]} /> ); diff --git a/src/stories/TransactionPreviewContent.stories.tsx b/src/stories/TransactionPreviewContent.stories.tsx index b5cceeef83cd..df08d7e8ec66 100644 --- a/src/stories/TransactionPreviewContent.stories.tsx +++ b/src/stories/TransactionPreviewContent.stories.tsx @@ -112,7 +112,7 @@ const story: Meta = { walletTermsErrors: undefined, routeName: SCREENS.TRANSACTION_DUPLICATE.REVIEW, shouldHideOnDelete: false, - wrapperStyles: {width: 256}, + wrapperStyle: {width: 256}, }, argTypes: { ...disabledProperties, From a36febffbfca38f6047d4fdb91eecff5c3454e8d Mon Sep 17 00:00:00 2001 From: Jakub Korytko Date: Thu, 10 Apr 2025 11:08:27 +0200 Subject: [PATCH 10/10] Add onPreviewPressed to every TransactionPreview for now --- .../ReportActionItem/MoneyRequestReportPreview/index.tsx | 1 + src/stories/MoneyRequestReportPreview.stories.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx index b100e1edce70..9a20c0638076 100644 --- a/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx +++ b/src/components/ReportActionItem/MoneyRequestReportPreview/index.tsx @@ -65,6 +65,7 @@ function MoneyRequestReportPreview({ isWhisper={isWhisper} isHovered={isHovered} iouReportID={iouReportID} + onPreviewPressed={() => {}} wrapperStyle={reportPreviewStyles.transactionPreviewStyle} containerStyles={[styles.h100, containerStyles]} transactionID={item.transactionID} diff --git a/src/stories/MoneyRequestReportPreview.stories.tsx b/src/stories/MoneyRequestReportPreview.stories.tsx index 55268d2b5019..33858c3840ff 100644 --- a/src/stories/MoneyRequestReportPreview.stories.tsx +++ b/src/stories/MoneyRequestReportPreview.stories.tsx @@ -44,6 +44,7 @@ const mockRenderItem: ListRenderItem = ({item}) => ( violations={item.errors ? violations : []} showContextMenu={() => undefined} offlineWithFeedbackOnClose={() => undefined} + onPreviewPressed={() => {}} navigateToReviewFields={() => undefined} isBillSplit={false} areThereDuplicates={false}