-
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
add create expense option to IOU actions #50239
add create expense option to IOU actions #50239
Conversation
f7ed357
to
a1d92ef
Compare
const trackOnlyCreateExpense = { | ||
icon: getIconForAction(CONST.IOU.TYPE.CREATE), | ||
text: translate('iou.createExpense'), | ||
onSelected: () => selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, report?.reportID ?? '-1'), 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.
You could just reuse the object from options
, no?
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, since we need to use the before methods for onSelected, but the new icon and text
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.
updated to reuse
const submitOnlyCreateExpense = { | ||
icon: getIconForAction(CONST.IOU.TYPE.CREATE), | ||
text: translate('iou.createExpense'), | ||
onSelected: () => selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, report?.reportID ?? '-1'), 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.
Same
@rushatgabhane 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] |
@@ -168,10 +170,58 @@ function AttachmentPickerWithMenuItems({ | |||
}, | |||
}; | |||
|
|||
return ReportUtils.temporary_getMoneyRequestOptions(report, policy, reportParticipantIDs ?? []).map((option) => ({ | |||
let list: PopoverMenuItem[] = ReportUtils.temporary_getMoneyRequestOptions(report, policy, reportParticipantIDs ?? []).map((option) => ({ |
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.
We should avoid using let
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.
Could we use a more descriptive name for this variable?
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.
Updated
if (list.some((option) => options[CONST.IOU.TYPE.TRACK].text === option.text) && list.some((option) => options[CONST.IOU.TYPE.SUBMIT].text === option.text)) { | ||
list = list.reduce((acc, item) => { | ||
if (item.text === translate('iou.submitExpense')) { | ||
acc.push(submitOnlyCreateExpense); | ||
} else if (item.text !== translate('iou.trackExpense')) { | ||
acc.push(item); | ||
} | ||
|
||
return acc; | ||
}, [] as PopoverMenuItem[]); | ||
} else if (list.some((option) => options[CONST.IOU.TYPE.TRACK].text === option.text)) { | ||
list = list.reduce((acc, item) => { | ||
if (item.text === translate('iou.trackExpense')) { | ||
acc.push(trackOnlyCreateExpense); | ||
} else { | ||
acc.push(item); | ||
} | ||
|
||
return acc; | ||
}, [] as PopoverMenuItem[]); |
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.
Would it be easier to not add the other options to the list in the first place?
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.
Updated to the approach without new elements
e8149eb
to
f6e9d87
Compare
@pasyukevich please fix eslint |
@rushatgabhane PR updated |
@rushatgabhane could you prioritize this review please? |
@rushatgabhane Bump 😅 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeScreen.Recording.2024-10-14.at.09.00.01.movMacOS: Chrome / SafariScreen.Recording.2024-10-14.at.08.54.27.movScreen.Recording.2024-10-14.at.08.55.47.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.
Above issues are unrelated but just noting them down, rest LGTM!
Thank you @rushatgabhane, I think we'll need to check with Anu about #50239 (comment) but neither point is a blocker for this 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.
LGTM
✋ 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/grgia in version: 9.0.49-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.49-2 🚀
|
Details
Fixed Issues
$ #49691
PROPOSAL:
Tests
For selfDM:
combinedTrackSubmit
beta enabled in your account.Create expense
option to open the page, assert the page's title isCreate expense
.Manual
tab, insert an amount and clickNext
to navigate to the next page. Assert the page's title isTrack expense
and there is aSubmit
button.For DM:
combinedTrackSubmit
beta enabled in your account.Create expense
option to open the page, assert the page's title isCreate expense
.Manual
tab, insert an amount and clickNext
to navigate to the next page. Assert the page's title isSubmit expense
and there is aSubmit
button.For Workspace:
combinedTrackSubmit
beta enabled in your account.Create expense
option to open the page, assert the page's title isCreate expense
.Manual
tab, insert an amount and clickNext
to navigate to the next page. Assert the page's title isSubmit expense
and there is aSubmit
button.Offline tests
QA Steps
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
[native-android-converted.webm](https://github.com/user-attachments/assets/73a145c5-2a40-4ab7-b6f4-577abc691ad8)Android: mWeb Chrome
web-android-converted.webm
iOS: Native
native-ios-converted.mp4
iOS: mWeb Safari
web-ios-converted.mp4
MacOS: Chrome / Safari
web-converted.mov
MacOS: Desktop
desktop-converted.mov