-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix Workspace Rate Unit Form Flow #34849
Fix Workspace Rate Unit Form Flow #34849
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
![]() ![]() ![]() Hello @akinwale I have almost completed the workspace rate unit form. If you want, you can start preliminary review. These are the screen made now (It has minor visual changes, otherwise evrything is completed). I will most probably open this for review tomorrow. |
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.
Done with a preliminary review. Looks good so far, but a number of changes required.
src/ROUTES.ts
Outdated
route: 'workspace/:policyID/rateandunit/unit', | ||
getRoute: (policyID: string, unit?: string, rate?: string) => | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
`workspace/${policyID}/rateandunit/unit${unit || rate ? '?' : ''}${unit ? `unit=${unit}` : ''}${unit && rate ? '&' : ''}${rate ? `rate=${rate}` : ''}` as const, |
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 entire block is confusing. Is there a way to simplify the parameters based on what the route actually ends with? This way, there is no need to conditionally check if it's rate or unit that is set.
For instance, for the WORKSPACE_RATE_AND_UNIT_RATE
route, just return workspace/${policyID}/rateandunit/rate
, and then load the rate value from Onyx.
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.
Am I allowed to create a new Onyx key for this?
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 reckon that's fine since we're moving away from a form to individual push-to-page screens. @tgolen Any thoughts on this?
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.
Adding new Onyx keys usually needs to be coordinated with the backend to ensure the new key is being populated properly. I might be missing some context for the rest of the question.
What Onyx key are you wanting to add and what does that have to do with the suggestion here (which I agree with) to clean up the routes?
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.
No it will be a temporary key. No need to sync it with backend.
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.
Please answer my question:
What Onyx key are you wanting to add and what does that have to do with the suggestion here?
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.
What Onyx key are you wanting to add and what does that have to do with the suggestion here?
I haven't thought of a name yet, but the Onyx key will behave similar to Task key, whose function would be to hold the values temporarily while we are editing the RateUnit form.
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.
@akinwale Can you give another pass at the PR?
src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx
Outdated
Show resolved
Hide resolved
src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage.tsx
Outdated
Show resolved
Hide resolved
src/pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage.tsx
Outdated
Show resolved
Hide resolved
…space-rate-unit-flow
@tgolen I noticed an old code in BNP, which we don't use at all now. The PR that introduced this #6547. We can do 2 things about this:
The reason for this question is that I am encountering a bug where long press leads to weird cursor behavior. cc @akinwale |
This is intended to be the title when updating the rate or unit. I think we could use just "Rate" or "Unit" respectively if we're getting rid of the "Track distance:" prefix. |
@shubham1206agra Please also remember to test with Spanish. On the BNP, the |
Reviewer Checklist
Screenshots/VideosAndroid: Native34849-android-native.mp4Android: mWeb Chrome34849-android-chrome.mp4iOS: Native34849-ios-native.mp4iOS: mWeb Safari34849-ios-safari.mp4MacOS: Chrome / Safari34849-web.mp4MacOS: Desktop34849-desktop.mp4 |
@shubham1206agra Please change the texts |
@akinwale 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.
submitButtonStyles?: StyleProp<ViewStyle>; | ||
|
||
/** Whether to apply flex to the submit button */ | ||
submitFlexEnabled?: boolean; |
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.
Why isn't this part of submitButtonStyles
?
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.
Tried this, but wasn't working correctly, so I decided to remove flex via prop.
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.
Can you expand on that a little more? What wasn't working?
Could you make flex1
part of the default styles, and then in the one component where it currently has submitFlexEnabled=false
, pass styles.flexReset
?
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.
flexReset
with flex1
doesn't work for some reason. It applies flex1
only.
✋ 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 production by https://github.com/thienlnam in version: 1.4.41-12 🚀
|
This PR causes the UI alignment issue |
function calculateAmountLength(amount: string, decimals: number): number { | ||
const leadingZeroes = amount.match(/^0+/); | ||
const leadingZeroesLength = leadingZeroes?.[0]?.length ?? 0; | ||
const absAmount = parseFloat((Number(stripCommaFromAmount(amount)) * 100).toFixed(2)).toString(); | ||
const absAmount = parseFloat((Number(stripCommaFromAmount(amount)) * 10 ** decimals).toFixed(2)).toString(); |
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 change caused issue #42084, some context:
In calculateAmountLength, we multiply the amount with 10 to the power of the number of decimals allowed on a currency. So, if the currency allows 2 decimals, then it will be multiplied by 100, that's why we can only input 8 digit length for currency like USD. But if the currency doesn't allow decimal, such as IQD, then we can input 10 digit length.
However, in the BE, all amounts are in cent, so the 10-digit length will be 12 digit length, and BE will return an error for it.
Details
Fixed Issues
$ #29533
PROPOSAL: #29533 (comment)
Tests
Offline tests
Same as 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 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
Screen.Recording.2024-02-11.at.5.42.51.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-02-11.at.5.03.31.PM.mov
iOS: Native
Screen.Recording.2024-02-11.at.5.16.25.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-02-11.at.4.56.19.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-02-11.at.4.51.45.PM.mov
MacOS: Desktop
Screen.Recording.2024-02-11.at.5.08.48.PM.mov