-
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 IOURequestStepTaxRatePage and IOURequestStepTaxAmountPage to TypeScript #39059
[TS migration] Migrate IOURequestStepTaxRatePage and IOURequestStepTaxAmountPage to TypeScript #39059
Conversation
type IOURequestStepTaxAmountPageProps = { | ||
transaction: OnyxEntry<Transaction>; | ||
} & IOURequestStepTaxAmountPageOnyxProps & | ||
WithWritableReportOrNotFoundProps; |
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.
Nit:
type IOURequestStepTaxAmountPageProps = { | |
transaction: OnyxEntry<Transaction>; | |
} & IOURequestStepTaxAmountPageOnyxProps & | |
WithWritableReportOrNotFoundProps; | |
type IOURequestStepTaxAmountPageProps = IOURequestStepTaxAmountPageOnyxProps & WithWritableReportOrNotFoundProps & { | |
transaction: OnyxEntry<Transaction>; | |
}; |
} & IOURequestStepTaxAmountPageOnyxProps & | ||
WithWritableReportOrNotFoundProps; | ||
|
||
const getTaxAmount = (transaction: OnyxEntry<Transaction>, defaultTaxValue: string | undefined) => { |
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.
Nit: transform to named function
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.
Also add a return type here
@@ -115,12 +98,13 @@ function IOURequestStepTaxAmountPage({ | |||
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CURRENCY.getRoute(iouType, transactionID, reportID, backTo ? 'confirm' : '', Navigation.getActiveRouteWithoutParams())); | |||
}; | |||
|
|||
const updateTaxAmount = (currentAmount) => { | |||
const updateTaxAmount = (currentAmount: {amount: string}) => { |
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.
Extract this inline type to a separate line
type IOURequestStepTaxRatePageProps = { | ||
transaction: OnyxEntry<Transaction>; | ||
} & IOURequestStepTaxRatePageOnyxProps & | ||
WithWritableReportOrNotFoundProps; |
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.
Same here:
type IOURequestStepTaxRatePageProps = IOURequestStepTaxRatePageOnyxProps &
WithWritableReportOrNotFoundProps & {
transaction: OnyxEntry<Transaction>;
};
} & IOURequestStepTaxRatePageOnyxProps & | ||
WithWritableReportOrNotFoundProps; | ||
|
||
const getTaxAmount = (taxRates: TaxRatesWithDefault, selectedTaxRate: string, amount: number) => { |
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.
Add a return type + transform to a named function
type IOURequestStepTaxRatePageProps = { | ||
transaction: OnyxEntry<Transaction>; | ||
} & IOURequestStepTaxRatePageOnyxProps & | ||
WithWritableReportOrNotFoundProps; |
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.
Do the same change as Marcin did here
src/libs/Navigation/types.ts
Outdated
transactionID: string; | ||
reportID: string; | ||
backTo: string; | ||
backTo: Routes | undefined; |
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.
Should this be | undefined or an optional property?
if (!transaction?.amount) { | ||
return; | ||
} | ||
const percentage = (transaction?.taxRate ? transaction?.taxRate?.data?.value : defaultTaxValue) ?? ''; |
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.
const percentage = (transaction?.taxRate ? transaction?.taxRate?.data?.value : defaultTaxValue) ?? ''; | |
const percentage = (transaction?.taxRate ? transaction?.taxRate?.data?.value : defaultTaxValue) ?? ''; |
} else { | ||
originalCurrency.current = currency; | ||
IOU.setMoneyRequestOriginalCurrency_temporaryForRefactor(transactionID, currency); | ||
} else if (transaction?.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.
make sure this change won't create regressions
} | ||
return () => { | ||
if (isSaveButtonPressed.current) { | ||
if (isSaveButtonPressed.current || !originalCurrency.current) { |
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.
same
@SzymczakJ can you make this PR as ready to review? |
Reviewing tomorrow! |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-app-2024-04-02_15.45.52.mp4Android: mWeb Chromeandroid-chrome-2024-04-02_15.30.52.mp4iOS: Nativeios-app-2024-04-02_16.08.00.mp4iOS: mWeb Safariios-safari-2024-04-02_16.01.18.mp4MacOS: Chrome / Safaridesktop-chrome-2024-04-02_14.40.39.mp4MacOS: Desktopdesktop-app-2024-04-02_15.17.33.mp4 |
@SzymczakJ Could you add the recording for Mac OS: Desktop? |
@jjcoffee done! |
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, tests well!
We did not find an internal engineer to review this PR, trying to assign a random engineer to #38915 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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.
Re-approving to get an engineer assigned!
@SzymczakJ we have conflicts here |
Looks good, just needs to resolve the conflicts. |
@rlinoz resolved conflicts |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/rlinoz in version: 1.4.61-0 🚀
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 1.4.61-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.61-8 🚀
|
if (!transaction?.amount) { | ||
return; | ||
} |
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.
This incomplete condition lead to this bug here #41434
Details
Fixed Issues
$ #38915
PROPOSAL:
Tests
To test this feature you have to have tax enabled on your Collect policy, this is how you can create it so it works in NewDot:
Offline tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
android.mov
Android: mWeb Chrome
androidweb.mov
iOS: Native
ios.mov
iOS: mWeb Safari
iosweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov