Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOU - RBR is present in LHN with transaction thread #40460

Merged
merged 14 commits into from
Jun 3, 2024
51 changes: 30 additions & 21 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 @@ -322,6 +323,11 @@ function MoneyRequestView({
const noticeTypeViolations = transactionViolations?.filter((violation) => violation.type === 'notice').map((v) => ViolationsUtils.getViolationTranslation(v, translate)) ?? [];
const shouldShowNotesViolations = !isReceiptBeingScanned && canUseViolations && ReportUtils.isPaidGroupPolicy(report);

const errors = {
kaushiktd marked this conversation as resolved.
Show resolved Hide resolved
...(transaction?.errorFields?.route ?? transaction?.errors),
...parentReportAction?.errors,
};

return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth, true, shouldShowAnimatedBackground)]}>
{shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />}
Expand All @@ -332,37 +338,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
Loading