-
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
Feat: Add Billable Toggle UI #27172
Feat: Add Billable Toggle UI #27172
Conversation
@0xmiroslav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Just have one stupid question, do I need to send "defaultBillable" or another name? |
@waterim Do you mean when sending to the API? Let's use Edit: also just to clarify, the API hasn't been updated yet to accept the param, so you won't be able to test end-to-end |
@amyevans Okay, will change it, thank you |
@waterim looks like you're missing screenshots/videos. |
Does this require any permission for testing? |
I see this in linked issue |
We should put it under the tags beta since we're trying to work incrementally so it's not a complete feature yet (and thus we don't want contributors reporting "bugs"). @waterim can you adjust your PR to check for the tags beta before displaying any UI? |
@amyevans Sorry, thats because of the conflicts resolve, will change today evening |
@waterim just to make sure we're on the same page. You'll want to add the If the user has the permission, then we'll want to show the billable toggle. |
@puneetlath ready for review Updated screenshots, added beta for tags and changed defaultBillable to billable for an API |
@0xmiroslav done |
@@ -530,6 +532,16 @@ function MoneyRequestConfirmationList(props) { | |||
disabled={didConfirm || props.isReadOnly} | |||
/> | |||
)} | |||
{canUseTags && !lodashGet(props.policy, 'disabledFields.defaultBillable', true) && ( |
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.
To confirm: billable toggle is only for expense request (workspace) right? Not applicable to IOU request (DM, group)?
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.
As I understand yes
@amyevans to be sure
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.
Yes, that's correct.
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.
Yes, correct. An IOU request doesn't have an associated policy ID so the field is never going to show for one, which is intended.
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.
Whoops I was too slow. Thanks Puneet 😄
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 to confirm that this uses same newDotTags
beta permission?
toggle setting doesn't persist after app refresh, while works on other fields Screen.Recording.2023-09-14.at.2.52.42.PM.mov |
@0xmiroslav Updated my solution, removed state, now after refresh it takes data from onyx(as all other fields), but after reset(for example go out from the request) it will be updated with default data from policy as it should be. |
@@ -77,6 +77,7 @@ function MoneyRequestConfirmPage(props) { | |||
if (policyExpenseChat) { | |||
Policy.openDraftWorkspaceRequest(policyExpenseChat.policyID); | |||
} | |||
if (typeof props.iou.defaultBillable !== 'boolean') IOU.setMoneyRequestDefaultBillable(lodashGet(props.policy, 'defaultBillable', false)); |
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.
if (typeof props.iou.defaultBillable !== 'boolean') IOU.setMoneyRequestDefaultBillable(lodashGet(props.policy, 'defaultBillable', false)); | |
if (typeof props.iou.defaultBillable !== 'boolean') { | |
IOU.setMoneyRequestDefaultBillable(lodashGet(props.policy, 'defaultBillable', false)); | |
} |
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.
+1 to the code style request, and also please add a comment explaining why we're doing this
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
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!
Left minor feedback but NAB
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.
A few small comments! Also, the Tests section and QA section need updating. For QA, let's say "None" because we're still behind a beta and don't want deploy blockers created for any failures. For tests:
- Login to the app
- Click "+" dropdown
- Click on "Request money"
- Type any number
- Click "Next"
- Select any
emailworkspace - Click "Show more"
- Look at the toggler
- Please describe what default state the toggle should have based on a policy's settings set in OldDot
- Please describe what should happen if you refresh the page
@@ -77,6 +77,7 @@ function MoneyRequestConfirmPage(props) { | |||
if (policyExpenseChat) { | |||
Policy.openDraftWorkspaceRequest(policyExpenseChat.policyID); | |||
} | |||
if (typeof props.iou.defaultBillable !== 'boolean') IOU.setMoneyRequestDefaultBillable(lodashGet(props.policy, 'defaultBillable', false)); |
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.
+1 to the code style request, and also please add a comment explaining why we're doing this
Resolved @amyevans |
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.
Just 1 super minor update, then we can
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.
Awesome 😎
✋ 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/amyevans in version: 1.3.72-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.3.72-11 🚀
|
withOnyx({ | ||
policy: { | ||
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, | ||
}, | ||
}), |
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 caused a regression #28182. The report object may be undefined and accessing the policyID on an undefined crashes the app.
<Switch | ||
accessibilityLabel={translate('common.billable')} | ||
isOn={props.iouIsBillable} | ||
onToggle={props.onToggleBillable} |
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.
It appears this was never added to the propType definitions. Can you please add it?
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.
In progress here: #29327
Thanks for flagging!
<Switch | ||
accessibilityLabel={translate('common.billable')} | ||
isOn={props.iouIsBillable} | ||
onToggle={props.onToggleBillable} |
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.
Here we missed to disable switch its readonly, caused #43756
Details
This PR is about to add Billable toggle to money request.
To test please insert this to App.js with your policyID you are testing:
Fixed Issues
$ #26128
PROPOSAL: #26128 (comment)
Tests
Offline tests
Same as tests
QA Steps
None
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android