Skip to content

Commit

Permalink
Merge pull request Expensify#40460 from kaushiktd/error-message
Browse files Browse the repository at this point in the history
IOU - RBR is present in LHN with transaction thread
  • Loading branch information
madmax330 authored Jun 3, 2024
2 parents ae12459 + e1e196d commit ca2d4b5
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import * as IOU from '@userActions/IOU';
import * as Transaction from '@userActions/Transaction';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import * as ReportActions from '@src/libs/actions/ReportActions';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
Expand Down Expand Up @@ -331,6 +332,11 @@ function MoneyRequestView({
const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);
const shouldShowReceiptHeader = isReceiptAllowed && (shouldShowReceiptEmptyState || shouldShowMapOrReceipt) && canUseViolations && ReportUtils.isPaidGroupPolicy(report);

const errors = {
...(transaction?.errorFields?.route ?? transaction?.errors),
...parentReportAction?.errors,
};

return (
<View style={styles.pRelative}>
{shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />}
Expand All @@ -341,37 +347,40 @@ function MoneyRequestView({
shouldShowAuditMessage={Boolean(shouldShowNotesViolations && didRceiptScanSucceed)}
/>
)}
{shouldShowMapOrReceipt && (
{(shouldShowMapOrReceipt || errors) && (
<OfflineWithFeedback
pendingAction={pendingAction}
errors={transaction?.errorFields?.route ?? transaction?.errors}
errors={errors}
errorRowStyles={[styles.mh4]}
onClose={() => {
if (!transaction?.transactionID) {
return;
}
Transaction.clearError(transaction.transactionID);
ReportActions.clearAllRelatedReportActionErrors(report.reportID, parentReportAction);
}}
>
<View style={styles.moneyRequestViewImage}>
{showMapAsImage ? (
<ConfirmedRoute
transaction={transaction}
interactive={false}
/>
) : (
<ReportActionItemImage
thumbnail={receiptURIs?.thumbnail}
fileExtension={receiptURIs?.fileExtension}
isThumbnail={receiptURIs?.isThumbnail}
image={receiptURIs?.image}
isLocalFile={receiptURIs?.isLocalFile}
filename={receiptURIs?.filename}
transaction={transaction}
enablePreviewModal
/>
)}
</View>
{shouldShowMapOrReceipt && (
<View style={styles.moneyRequestViewImage}>
{showMapAsImage ? (
<ConfirmedRoute
transaction={transaction}
interactive={false}
/>
) : (
<ReportActionItemImage
thumbnail={receiptURIs?.thumbnail}
fileExtension={receiptURIs?.fileExtension}
isThumbnail={receiptURIs?.isThumbnail}
image={receiptURIs?.image}
isLocalFile={receiptURIs?.isLocalFile}
filename={receiptURIs?.filename}
transaction={transaction}
enablePreviewModal
/>
)}
</View>
)}
</OfflineWithFeedback>
)}
{shouldShowReceiptEmptyState && (
Expand Down

0 comments on commit ca2d4b5

Please sign in to comment.