-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[TS migration] Migrate 'ReportActionItemMoneyRequest' component to TypeScript #34564
[TS migration] Migrate 'ReportActionItemMoneyRequest' component to TypeScript #34564
Conversation
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestView.tsx
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestView.tsx
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestPreview.tsx # src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
…mponent # Conflicts: # src/types/onyx/Policy.ts
…s back to the second hoc
…mponent # Conflicts: # src/types/onyx/TransactionViolation.ts # src/types/onyx/index.ts
const getDisplayDeleteAmountText = () => { | ||
const {amount, currency} = ReportUtils.getTransactionDetails(props.action.originalMessage); | ||
|
||
if (isDistanceRequest) { | ||
return CurrencyUtils.convertToDisplayString(TransactionUtils.getAmount(props.action.originalMessage), currency); | ||
} | ||
const getDisplayDeleteAmountText = (): string => { | ||
const iouOriginalMessage: IOUMessage | EmptyObject = action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? action.originalMessage : {}; | ||
const {amount = 0, currency = CONST.CURRENCY.USD} = iouOriginalMessage; | ||
|
||
return CurrencyUtils.convertToDisplayString(amount, currency); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During this file migration, it turned out that originalMessage
of action is passed to methods where transaction
is expected to get the amount and currency values. Though originalMessage
doesn't look like transaction at all
After some testing I've find out that the functionality of getDisplayDeleteAmountText
function can be simplified.
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestPreview.tsx
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestView.tsx # src/libs/ReceiptUtils.ts
…mponent # Conflicts: # src/types/onyx/Policy.ts
…mponent # Conflicts: # src/types/onyx/Policy.ts
…mponent # Conflicts: # src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestAction.tsx # src/components/ReportActionItem/MoneyRequestPreview.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! LGTM
@rushatgabhane kind bump 🙂 |
@rushatgabhane Hey, any ETA on reviewing this one? 🙂 |
Reviewer Checklist
Screenshots/VideosMacOS: Desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We did not find an internal engineer to review this PR, trying to assign a random engineer to #31983 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@mountiny Could we assign a engineer here? Looks like Melvin didn't assign anyone. |
@aldo-expensify all yours! |
@VickyStash there are conflicts now, please resolve 🙏 |
…mponent # Conflicts: # src/components/ReportActionItem/MoneyRequestPreview.tsx # src/components/ReportActionItem/MoneyRequestView.tsx
@aldo-expensify Done 👌 |
Thank you!, this is a |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.36-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
1 similar comment
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.36-5 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
<Text style={[styles.textLabel, styles.colorMuted]}>{translate('iou.pendingConversionMessage')}</Text> | ||
)} | ||
{shouldShowDescription && <RenderHTML html={parser.replace(merchantOrDescription)} />} | ||
{shouldShowMerchant && <Text style={[styles.textLabelSupporting, styles.textNormal]}>{merchantOrDescription}</Text>} | ||
</View> | ||
{props.isBillSplit && !_.isEmpty(participantAccountIDs) && requestAmount > 0 && ( | ||
{isBillSplit && participantAccountIDs.length > 0 && requestAmount && requestAmount > 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VickyStash Native app crashes on this line. Can you please raise quick PR fixing that?
{isBillSplit && participantAccountIDs.length > 0 && requestAmount && requestAmount > 0 && ( | |
{isBillSplit && participantAccountIDs.length > 0 && !!requestAmount && requestAmount > 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@situchan I'm taking a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@situchan could you please provide me steps for reproduction so I can be sure the issue is fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested that solution myself. Works well.
I was just testing #35876. Please try to follow QA step on that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that happens when requestAmount
= 0
Try this:
A request $10 from B
B request $10 (same amount) from A
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@situchan I got what you mean and it makes sense to me, but I'm still not able to trigger this case on the main, could you please provide me reproduction video 🙏
Navigation.navigate(ROUTES.SPLIT_BILL_DETAILS.getRoute(chatReportID, reportActionID)); | ||
return; | ||
} | ||
|
||
// If the childReportID is not present, we need to create a new thread | ||
const childReportID = lodashGet(action, 'childReportID', 0); | ||
const childReportID = action?.childReportID ?? '0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VickyStash heads up! All IDs must be numbers, this created this bug #35904. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accountIDs are numbers and reportIDs are strings, right? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@youssef-lr reportIDs are expected to be string, otherwise they can overflow, right?
Unless this changed lately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry my bad, they are all numbers in the backend, but in JS reportIDs
& reportActionIDs
are strings. In this specific example it doesn't make sense to use '0'
, because the condition below this line evaluates to false
when it should evaluate to true
if (!childReportID) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@youssef-lr you are right, my bad!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented in your PR @youssef-lr , I don't think we should default to 0 either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that sounds good, updated.
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.37-7 🚀
|
Details
[TS migration] Migrate 'ReportActionItemMoneyRequest' component to TypeScript
Fixed Issues
$ #31983
PROPOSAL: N/A
Tests
Requests to another User
Manual
andScan
money requests to another user.Receipt scan in progress...
.Manual
Money request preview to open its view. Make sure it looks as expected and has all the necessary data. You can also update Description/Date fields.Scan
Money request preview to open its view. Make sure it looks same way as before and has all the necessary data.Requests to Workspace
Manual
,Scan
andDistance
money requests to the workspace.Distance
Money request preview to open its view. Make sure it looks the same way as before and has all the necessary data.Offline tests
Manual
,Scan
andDistance
money requests to the workspace.QA Steps
Same as in Tests + Offline Tests sections
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android1.mp4
Android: mWeb Chrome
android_web1.mp4
iOS: Native
ios1.mp4
iOS: mWeb Safari
ios_web1.mp4
MacOS: Chrome / Safari
web1.mp4
MacOS: Desktop
desktop1.mp4