[TS migration] Migrate IOURequestStepTaxRatePage and IOURequestStepTaxAmountPage to TypeScript#39059
Conversation
| type IOURequestStepTaxAmountPageProps = { | ||
| transaction: OnyxEntry<Transaction>; | ||
| } & IOURequestStepTaxAmountPageOnyxProps & | ||
| WithWritableReportOrNotFoundProps; |
There was a problem hiding this comment.
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.
Nit: transform to named function
There was a problem hiding this comment.
Also add a return type here
| }; | ||
|
|
||
| const updateTaxAmount = (currentAmount) => { | ||
| const updateTaxAmount = (currentAmount: {amount: string}) => { |
There was a problem hiding this comment.
Extract this inline type to a separate line
| type IOURequestStepTaxRatePageProps = { | ||
| transaction: OnyxEntry<Transaction>; | ||
| } & IOURequestStepTaxRatePageOnyxProps & | ||
| WithWritableReportOrNotFoundProps; |
There was a problem hiding this comment.
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.
Add a return type + transform to a named function
| type IOURequestStepTaxRatePageProps = { | ||
| transaction: OnyxEntry<Transaction>; | ||
| } & IOURequestStepTaxRatePageOnyxProps & | ||
| WithWritableReportOrNotFoundProps; |
src/libs/Navigation/types.ts
Outdated
| transactionID: string; | ||
| reportID: string; | ||
| backTo: string; | ||
| backTo: Routes | undefined; |
There was a problem hiding this comment.
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.
| 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.
make sure this change won't create regressions
| } | ||
| return () => { | ||
| if (isSaveButtonPressed.current) { | ||
| if (isSaveButtonPressed.current || !originalCurrency.current) { |
|
@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! |
|
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! |
jjcoffee
left a comment
There was a problem hiding this comment.
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.
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 Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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