-
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
[NoQA] feat: show next steps for draft reports #29309
Conversation
Oops, conflicts 🏃♀️ |
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 a minor comment.
@robertKozik 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] |
Reviewer Checklist
Screenshots/Videos |
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
let nextStepHTML = ''; | ||
|
||
const messageArray = _.isEmpty(nextStep.expenseMessage) ? nextStep.message : nextStep.expenseMessage; | ||
_.each(messageArray, (part) => { | ||
const tagType = part.type || 'span'; | ||
nextStepHTML += `<${tagType}>${Str.safeEscape(part.text)}</${tagType}>`; | ||
}); | ||
|
||
return nextStepHTML | ||
.replace(/%expenses/g, 'this expense') | ||
.replace(/%Expenses/g, 'This expense') | ||
.replace(/%tobe/g, 'is'); |
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 think we should move this to some Utils file. Maybe NextStepUtils.js and create a parseMessage method there
src/pages/nextStepPropTypes.js
Outdated
/** The title for the next step */ | ||
title: PropTypes.string, | ||
|
||
/** Whether the the user must take some sort of action in order to unblock the report */ |
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.
/** Whether the the user must take some sort of action in order to unblock the report */ | |
/** Whether the user should take some sort of action in order to unblock the report */ |
src/pages/nextStepPropTypes.js
Outdated
/** If the "Undo submit" button should be visible */ | ||
showUndoSubmit: PropTypes.bool, | ||
|
||
/** If the next step should be displayed on mobile */ |
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 the next step should be displayed on mobile */ | |
/** Deprecated - If the next step should be displayed on mobile, related to OldApp */ |
@mountiny I'll take over this issue from Ana |
@mountiny done 🙂 |
src/components/MoneyReportHeader.js
Outdated
/> | ||
</View> | ||
)} | ||
<View style={[styles.dFlex, styles.flexColumn, styles.borderBottom]}> |
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.
src/components/MoneyReportHeader.js
Outdated
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextSteps; | ||
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); | ||
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableTotal, moneyRequestReport.currency); | ||
const isShowingMoreContent = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextSteps; |
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.
these two expressions are now same I think we could reuse 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.
Thanks for help!
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport); | ||
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableTotal, moneyRequestReport.currency); | ||
const isMoreContentShown = shouldShowNextSteps || (shouldShowAnyButton && isSmallScreenWidth); |
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.
NAB we can do this in another PR but I think we can name this const like hasSecondRow
which would suit it better
✋ 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/mountiny in version: 1.3.88-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.88-11 🚀
|
Emails were not wrapping correctly in the next steps message so we dealt with this in #32910 |
Details
Added support for showing the next steps of a draft report on the header of a money request report. It only contains support for showing the next step message (no actions or buttons).
Fixed Issues
$ #28767
Tests
To test this currently, it requires some setup. Check the dropdown below. Use Staging server.
Required setup
MoneyReportHeader.js
and copy paste the code below inside theuseEffect
with empty dependency array. Use the report ID of the previous post. This will make the report have the status of open/draft.Offline tests
Similar to the one above
QA Steps
N/A cant be tested right now
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
Android: Native
With bigger text:
Android: mWeb Chrome
With bigger text:
iOS: Native
With bigger text:
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop