-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add One Transaction Report View #36934
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
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
53ada16
report action utils functions
NikkiWines df1b56c
report utils functions for one transaction report
NikkiWines b841b6a
hide background for money requests on a single transaction report
NikkiWines 7ec2e5c
update css style for money request
NikkiWines 353b740
update report actions items to retrieve transaction thread report det…
NikkiWines 42adcea
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 66f498b
use undefined instead of {}
NikkiWines de66987
check prevProps
NikkiWines 74a42f6
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 1bf4c04
simplify transactionThreadReportActions display
NikkiWines 6153bab
minor style and lint updates
NikkiWines d436ffe
use simplified report icons when applicable
NikkiWines b722725
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines b13fc4b
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 452d012
add transactionThreadReportID to report structure for onyx and props
NikkiWines cac6d81
simplify transactionThreadReportID logic to use value returned in the…
NikkiWines 6a08ba5
minor style
NikkiWines 1674735
don't show report if transaction thread and expense report have the s…
NikkiWines f3f5e52
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 90bc361
update default value for transactionThreadReportActions key
NikkiWines 0f21504
update utils files to no longer reference report.transactionThreadRep…
NikkiWines 4bb0313
use general report and reportActions onyx keys instead of relying on …
NikkiWines 35d0264
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines c941d23
update getOneTransactionReportID to take in only reportActions
NikkiWines 2a02be8
fix some malformed logic
NikkiWines b5ae144
ensure we don't show outdated UI due to removed IOU requests
NikkiWines f6cfcb3
use transaction currency instead of checking between transactionThrea…
NikkiWines 0140912
merge main and address conflicts from ts migrations for ReportActionItem
NikkiWines db05afc
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines c274090
style and ts updates
NikkiWines 618b5ac
minor style
NikkiWines 31cf018
adjust currency and filtering combined reportActions logic
NikkiWines 6b2d28a
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 1b27a33
minor adjustments and stylistic changes
NikkiWines d36bc98
ts fixes
NikkiWines 686a2dc
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 7994917
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 1003a1f
get transactionThreadReportActions in ReportActionsView instead of Re…
NikkiWines de600c8
pass transactionThreadReport and reportActions for report to reportAc…
NikkiWines 034b93f
lint / style
NikkiWines 716023c
supress incorrect linter error
NikkiWines 3b88172
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 45c7fc1
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines f9f3607
update reportActionsView to account for getting newer and older repor…
NikkiWines e3be337
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 1090c5b
type resolution
NikkiWines a4926d3
updates to one-transaction utils functions
NikkiWines 7dd2384
use reportActionsByReport, and some minor stylistic updates
NikkiWines fec3aa3
pass transactionThreadReportID from ReportScreen
NikkiWines 5438f69
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines 1aac6e0
Merge branch 'main' of github.com:Expensify/App into nikki-one-transa…
NikkiWines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; | |
| import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
| import * as ReportUtils from '@libs/ReportUtils'; | ||
| import SelectionScraper from '@libs/SelectionScraper'; | ||
| import * as TransactionUtils from '@libs/TransactionUtils'; | ||
| import {ReactionListContext} from '@pages/home/ReportScreenContext'; | ||
| import * as BankAccounts from '@userActions/BankAccounts'; | ||
| import * as EmojiPickerAction from '@userActions/EmojiPickerAction'; | ||
|
|
@@ -100,12 +101,22 @@ type ReportActionItemOnyxProps = { | |
|
|
||
| /** The policy which the user has access to and which the report is tied to */ | ||
| policy: OnyxEntry<OnyxTypes.Policy>; | ||
|
|
||
| /** Transaction associated with this report, if any */ | ||
| transaction: OnyxEntry<OnyxTypes.Transaction>; | ||
| }; | ||
|
|
||
| type ReportActionItemProps = { | ||
| /** Report for this action */ | ||
| report: OnyxTypes.Report; | ||
|
|
||
| /** The transaction thread report associated with the report for this action, if any */ | ||
| transactionThreadReport: OnyxEntry<OnyxTypes.Report>; | ||
|
|
||
| /** Array of report actions for the report for this action */ | ||
| // eslint-disable-next-line react/no-unused-prop-types | ||
| reportActions: OnyxTypes.ReportAction[]; | ||
NikkiWines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** Report action belonging to the report's parent */ | ||
| parentReportAction: OnyxEntry<OnyxTypes.ReportAction>; | ||
|
|
||
|
|
@@ -142,6 +153,7 @@ const isIOUReport = (actionObj: OnyxEntry<OnyxTypes.ReportAction>): actionObj is | |
| function ReportActionItem({ | ||
| action, | ||
| report, | ||
| transactionThreadReport, | ||
| linkedReportActionID, | ||
| displayAsGroup, | ||
| emojiReactions, | ||
|
|
@@ -155,6 +167,7 @@ function ReportActionItem({ | |
| shouldHideThreadDividerLine = false, | ||
| shouldShowSubscriptAvatar = false, | ||
| policy, | ||
| transaction, | ||
| onPress = undefined, | ||
| }: ReportActionItemProps) { | ||
| const {translate} = useLocalize(); | ||
|
|
@@ -180,7 +193,7 @@ function ReportActionItem({ | |
| const originalReportID = ReportUtils.getOriginalReportID(report.reportID, action); | ||
| const originalReport = report.reportID === originalReportID ? report : ReportUtils.getReport(originalReportID); | ||
| const isReportActionLinked = linkedReportActionID && action.reportActionID && linkedReportActionID === action.reportActionID; | ||
|
|
||
| const transactionCurrency = TransactionUtils.getCurrency(transaction); | ||
| const reportScrollManager = useReportScrollManager(); | ||
|
|
||
| const highlightedBackgroundColorIfNeeded = useMemo( | ||
|
|
@@ -700,6 +713,7 @@ function ReportActionItem({ | |
| <MoneyRequestView | ||
| report={report} | ||
| shouldShowHorizontalRule={!shouldHideThreadDividerLine} | ||
| shouldShowAnimatedBackground | ||
| /> | ||
| </ShowContextMenuContext.Provider> | ||
| ); | ||
|
|
@@ -739,11 +753,30 @@ function ReportActionItem({ | |
| if (ReportUtils.isExpenseReport(report) || ReportUtils.isIOUReport(report)) { | ||
| return ( | ||
| <OfflineWithFeedback pendingAction={action.pendingAction}> | ||
| <MoneyReportView | ||
| report={report} | ||
| policy={policy} | ||
| shouldShowHorizontalRule={!shouldHideThreadDividerLine} | ||
| /> | ||
| {transactionThreadReport && !isEmptyObject(transactionThreadReport) ? ( | ||
| <> | ||
| {transactionCurrency !== report.currency && ( | ||
| <MoneyReportView | ||
| report={report} | ||
| policy={policy} | ||
| shouldShowHorizontalRule={!shouldHideThreadDividerLine} | ||
| /> | ||
| )} | ||
|
Comment on lines
+756
to
+764
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. For BZ checklist in #44162: |
||
| <ShowContextMenuContext.Provider value={contextValue}> | ||
| <MoneyRequestView | ||
| report={transactionThreadReport} | ||
| shouldShowHorizontalRule={!shouldHideThreadDividerLine} | ||
| shouldShowAnimatedBackground={transactionCurrency === report.currency} | ||
| /> | ||
| </ShowContextMenuContext.Provider> | ||
| </> | ||
| ) : ( | ||
| <MoneyReportView | ||
| report={report} | ||
| policy={policy} | ||
| shouldShowHorizontalRule={!shouldHideThreadDividerLine} | ||
| /> | ||
| )} | ||
| </OfflineWithFeedback> | ||
| ); | ||
| } | ||
|
|
@@ -899,6 +932,14 @@ export default withOnyx<ReportActionItemProps, ReportActionItemOnyxProps>({ | |
| userWallet: { | ||
| key: ONYXKEYS.USER_WALLET, | ||
| }, | ||
| transaction: { | ||
| key: ({transactionThreadReport, reportActions}) => { | ||
| const parentReportActionID = isEmptyObject(transactionThreadReport) ? '0' : transactionThreadReport.parentReportActionID; | ||
| const action = reportActions?.find((reportAction) => reportAction.reportActionID === parentReportActionID); | ||
| const transactionID = (action as OnyxTypes.OriginalMessageIOU)?.originalMessage.IOUTransactionID ? (action as OnyxTypes.OriginalMessageIOU).originalMessage.IOUTransactionID : 0; | ||
| return `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`; | ||
| }, | ||
| }, | ||
| })( | ||
| memo(ReportActionItem, (prevProps, nextProps) => { | ||
| const prevParentReportAction = prevProps.parentReportAction; | ||
|
|
@@ -930,6 +971,9 @@ export default withOnyx<ReportActionItemProps, ReportActionItemOnyxProps>({ | |
| prevProps.linkedReportActionID === nextProps.linkedReportActionID && | ||
| lodashIsEqual(prevProps.report.fieldList, nextProps.report.fieldList) && | ||
| lodashIsEqual(prevProps.policy, nextProps.policy) && | ||
| lodashIsEqual(prevProps.transactionThreadReport, nextProps.transactionThreadReport) && | ||
| lodashIsEqual(prevProps.reportActions, nextProps.reportActions) && | ||
| lodashIsEqual(prevProps.transaction, nextProps.transaction) && | ||
| lodashIsEqual(prevParentReportAction, nextParentReportAction) | ||
| ); | ||
| }), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.