-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix: Combined report is more grayed #49633
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
Changes from all commits
3b81f84
b474873
761cd4e
c1b9645
5683250
f8f37d1
419d5c1
36ccd88
c9dd459
c12613c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import * as reportActions from '@src/libs/actions/Report'; | |
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import type {Policy, PolicyReportField, Report} from '@src/types/onyx'; | ||
| import type {PendingAction} from '@src/types/onyx/OnyxCommon'; | ||
|
|
||
| type MoneyReportViewProps = { | ||
| /** The report currently being looked at */ | ||
|
|
@@ -41,9 +42,11 @@ type MoneyReportViewProps = { | |
|
|
||
| /** Flag to show, hide the thread divider line */ | ||
| shouldHideThreadDividerLine: boolean; | ||
|
|
||
| pendingAction?: PendingAction; | ||
| }; | ||
|
|
||
| function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTotal = true, shouldHideThreadDividerLine}: MoneyReportViewProps) { | ||
| function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTotal = true, shouldHideThreadDividerLine, pendingAction}: MoneyReportViewProps) { | ||
| const theme = useTheme(); | ||
| const styles = useThemeStyles(); | ||
| const StyleUtils = useStyleUtils(); | ||
|
|
@@ -118,7 +121,8 @@ function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTo | |
|
|
||
| return ( | ||
| <OfflineWithFeedback | ||
| pendingAction={report.pendingFields?.[fieldKey]} | ||
| // Need to return undefined when we have pendingAction to avoid the duplicate pending action | ||
| pendingAction={pendingAction ? undefined : report.pendingFields?.[fieldKey]} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a comment to explain why we return
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to return the pending field action here as
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, can we add this context as a comment in the code? I don't think it would be obvious to the next person who reads this code. |
||
| errors={report.errorFields?.[fieldKey]} | ||
| errorRowStyles={styles.ph5} | ||
| key={`menuItem-${fieldKey}`} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,7 +275,8 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals | |
| receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(updatedTransaction ?? transaction); | ||
| } | ||
| const pendingAction = transaction?.pendingAction; | ||
| const getPendingFieldAction = (fieldPath: TransactionPendingFieldsKey) => transaction?.pendingFields?.[fieldPath] ?? pendingAction; | ||
| // Need to return undefined when we have pendingAction to avoid the duplicate pending action | ||
| const getPendingFieldAction = (fieldPath: TransactionPendingFieldsKey) => (pendingAction ? undefined : transaction?.pendingFields?.[fieldPath]); | ||
nkdengineer marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as above |
||
|
|
||
| const getErrorForField = useCallback( | ||
| (field: ViolationField, data?: OnyxTypes.TransactionViolation['data'], policyHasDependentTags = false, tagValue?: string) => { | ||
|
|
@@ -472,10 +473,12 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals | |
| {shouldShowAnimatedBackground && <AnimatedEmptyStateBackground />} | ||
| <> | ||
| {shouldShowReceiptAudit && ( | ||
| <ReceiptAudit | ||
| notes={receiptViolations} | ||
| shouldShowAuditResult={!!shouldShowAuditMessage} | ||
| /> | ||
| <OfflineWithFeedback pendingAction={getPendingFieldAction('receipt')}> | ||
| <ReceiptAudit | ||
| notes={receiptViolations} | ||
| shouldShowAuditResult={!!shouldShowAuditMessage} | ||
| /> | ||
| </OfflineWithFeedback> | ||
| )} | ||
| {(hasReceipt || errors) && ( | ||
| <OfflineWithFeedback | ||
|
|
@@ -525,21 +528,23 @@ function MoneyRequestView({report, shouldShowAnimatedBackground, readonly = fals | |
| </OfflineWithFeedback> | ||
| )} | ||
| {shouldShowReceiptEmptyState && ( | ||
| <ReceiptEmptyState | ||
| hasError={hasErrors} | ||
| disabled={!canEditReceipt} | ||
| onPress={() => | ||
| Navigation.navigate( | ||
| ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute( | ||
| CONST.IOU.ACTION.EDIT, | ||
| iouType, | ||
| transaction?.transactionID ?? '-1', | ||
| report?.reportID ?? '-1', | ||
| Navigation.getReportRHPActiveRoute(), | ||
| ), | ||
| ) | ||
| } | ||
| /> | ||
| <OfflineWithFeedback pendingAction={getPendingFieldAction('receipt')}> | ||
| <ReceiptEmptyState | ||
| hasError={hasErrors} | ||
| disabled={!canEditReceipt} | ||
| onPress={() => | ||
| Navigation.navigate( | ||
| ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute( | ||
| CONST.IOU.ACTION.EDIT, | ||
| iouType, | ||
| transaction?.transactionID ?? '-1', | ||
| report?.reportID ?? '-1', | ||
| Navigation.getReportRHPActiveRoute(), | ||
| ), | ||
| ) | ||
| } | ||
| /> | ||
| </OfflineWithFeedback> | ||
| )} | ||
| {!shouldShowReceiptEmptyState && !hasReceipt && <View style={{marginVertical: 6}} />} | ||
| {shouldShowAuditMessage && <ReceiptAuditMessages notes={receiptImageViolations} />} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.