-
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
Show scan status bar when one of the receipt is scanning in expense report #42240
Show scan status bar when one of the receipt is scanning in expense report #42240
Conversation
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.
@bernhardoj
I have suggested a small change to use optional chaining operator at one place to be on the safer side. Please have a look.
Otherwise LGTM. Tests well too.
src/components/MoneyReportHeader.tsx
Outdated
@@ -104,6 +104,7 @@ function MoneyReportHeader({ | |||
const isDraft = ReportUtils.isOpenExpenseReport(moneyRequestReport); | |||
const [isConfirmModalVisible, setIsConfirmModalVisible] = useState(false); | |||
|
|||
const hasScanningReceipt = ReportUtils.getTransactionsWithReceipts(moneyRequestReport.reportID).some((transaction) => TransactionUtils.isReceiptBeingScanned(transaction)); |
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.
const hasScanningReceipt = ReportUtils.getTransactionsWithReceipts(moneyRequestReport.reportID).some((transaction) => TransactionUtils.isReceiptBeingScanned(transaction)); | |
const hasScanningReceipt = ReportUtils.getTransactionsWithReceipts(moneyRequestReport?.reportID).some((transaction) => TransactionUtils.isReceiptBeingScanned(transaction)); |
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
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari42240-web-safari.mp442240-web-safari-ioureport.mp4Android: Native4220-android-native.mp4Android: mWeb Chrome4220-mweb-chrome.mp4iOS: Native42240-ios-native.mp4iOS: mWeb Safari42240-mweb-safari.mp4MacOS: Desktop4220-desktop.mp4 |
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 @bernhardoj
LGTM and tests well.
@bernhardoj There are conflicts here. Can you please resolve them? |
Conflicts solved |
@@ -224,7 +226,7 @@ function MoneyReportHeader({ | |||
shouldShowBackButton={shouldUseNarrowLayout} | |||
onBackButtonPress={onBackButtonPress} | |||
// Shows border if no buttons or next steps are showing below the header | |||
shouldShowBorderBottom={!(shouldShowAnyButton && shouldUseNarrowLayout) && !(shouldShowNextStep && !shouldUseNarrowLayout) && !allHavePendingRTERViolation} | |||
shouldShowBorderBottom={!isMoreContentShown && !allHavePendingRTERViolation} |
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.
@bernhardoj hmm.. Looks like I am missing something here. Can you please help me understand why we need to replace the existing conditions with isMoreContentShown
? Both seem to be different.
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'm trying to simplify it. We need to set shouldShowBorderBottom
to false if hasScanningReceipt
is true, but instead of appending it to the existing condition (&& !hasScanningReceipt), I just replaced it with isMoreContentShown
.
Without simplifying:
!(shouldShowAnyButton && shouldUseNarrowLayout) && !(shouldShowNextStep && !shouldUseNarrowLayout) && !hasScanningReceipt && !allHavePendingRTERViolation
isMoreContentShown
condition
shouldShowNextStep || hasScanningReceipt || (shouldShowAnyButton && shouldUseNarrowLayout)
If we reverse this (!isMoreContentShown), it becomes,
!shouldShowNextStep && !hasScanningReceipt && !(shouldShowAnyButton && shouldUseNarrowLayout)
repositioned:
!(shouldShowAnyButton && shouldUseNarrowLayout) && !shouldShowNextStep && !hasScanningReceipt
You can see that hasScanningReceipt
and shouldShowAnyButton
condition is the same. The only difference is shouldShowNextStep
.
Next step component is put outside of the HeaderWithBackButton, no matter whether it's shouldUseNarrowLayout
or not which has its own border bottom.
App/src/components/MoneyReportHeader.tsx
Lines 335 to 339 in 8375abe
{shouldShowNextStep && ( | |
<View style={[styles.ph5, styles.pb3]}> | |
<MoneyReportHeaderStatusBar nextStep={nextStep} /> | |
</View> | |
)} |
App/src/components/MoneyReportHeader.tsx
Line 303 in 8375abe
<View style={isMoreContentShown ? [styles.dFlex, styles.flexColumn, styles.borderBottom] : []}> |
So, we don't want the extra border bottom from the HeaderWithBackButton anymore.
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. That helps.
@thienlnam All yours for review. |
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.
Great, thanks yall!
✋ 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/thienlnam in version: 1.4.77-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.77-11 🚀
|
Details
We want to show the scanning status bar below the header when there is a scanning receipt.
Fixed Issues
$ #40828
PROPOSAL: #40828 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
Screen.Recording.2024-05-16.at.13.17.18.1.mov
MacOS: Chrome / Safari
MacOS: Desktop
Screen.Recording.2024-05-16.at.13.14.42.mov