[Better Expense Reports] Stand-alone TransactionPreviews' jumping fix#64234
Conversation
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
@DylanDylann 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] |
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
Videos seem good to me 👍 |
| transactionID={shouldShowSplitPreview ? moneyRequestOriginalMessage?.IOUTransactionID : undefined} | ||
| containerStyles={[shouldUseNarrowLayout ? {...styles.w100, ...styles.mw100} : reportPreviewStyles.transactionPreviewStyle, styles.mt1]} | ||
| transactionPreviewWidth={shouldUseNarrowLayout ? styles.w100.width : reportPreviewStyles.transactionPreviewStyle.width} | ||
| transactionID={isSplitInGroupChat ? moneyRequestOriginalMessage?.IOUTransactionID : undefined} |
There was a problem hiding this comment.
Why do you change the condition from shouldShowSplitPreview to isSplitInGroupChat?
There was a problem hiding this comment.
I don't quite know why this highlights as my change, because it looks like @JakubKorytko changed it before me - I didn't delve into this logic, so I left it unchanged - if you feel like shouldShowSplitPreview is a better choice I can change it 👍
There was a problem hiding this comment.
If this isn't related to our PR, please revert this change
| const singleTransactionPreviewWidth = shouldUseNarrowLayout ? styles.w100.width : reportPreviewStyles.transactionPreviewStyle.width; | ||
| const singleTransactionPreviewStyles = [shouldUseNarrowLayout ? {...styles.w100, ...styles.mw100} : reportPreviewStyles.transactionPreviewStyle, styles.mt2]; | ||
| // Condition extracted from MoneyRequestPreview | ||
| if (lodashIsEmpty(iouReport) && !(isSplitBillAction || isTrackExpenseAction)) { |
There was a problem hiding this comment.
Why do you remove isReviewDuplicateTransactionPage condition?
There was a problem hiding this comment.
'TransactionReport' has been implemented in the rest of the app by @JakubKorytko, so this condition is redundant - because the styling changes here, the logic can be simplified to the same TransacitonPreview component with minor styling changes.
|
@Guccio163 could you please write a proposal to describe your solution first? I think it will help everyone understand your idea thoroughly and save discussion time |
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
This PR simply changes styling of the |
| transactionID={shouldShowSplitPreview ? moneyRequestOriginalMessage?.IOUTransactionID : undefined} | ||
| containerStyles={[shouldUseNarrowLayout ? {...styles.w100, ...styles.mw100} : reportPreviewStyles.transactionPreviewStyle, styles.mt1]} | ||
| transactionPreviewWidth={shouldUseNarrowLayout ? styles.w100.width : reportPreviewStyles.transactionPreviewStyle.width} | ||
| transactionID={isSplitInGroupChat ? moneyRequestOriginalMessage?.IOUTransactionID : undefined} |
There was a problem hiding this comment.
If this isn't related to our PR, please revert this change
| transactionPreviewStandaloneStyle: {width: `min(100%, ${TRANSACTION_WIDTH_WIDE}px)`, maxWidth: `min(100%, ${TRANSACTION_WIDTH_WIDE}px)`}, | ||
| componentStyle: [{maxWidth: `min(${carouselExactMaxWidth}px, 100%)`}, {width: currentWrapperWidth > minimalWrapperWidth ? 'min-content' : '100%'}], | ||
| expenseCountVisible: transactionPreviewWidth >= TRANSACTION_WIDTH_WIDE, | ||
| transactionWidth: currentWrapperWidth > minimalWrapperWidth ? TRANSACTION_WIDTH_WIDE : transactionPreviewWidth, |
There was a problem hiding this comment.
I see that transactionPreviewCarouselStyle.width and transactionWidth have a slight difference (currentWrapperWidth === 0). With this logic, transactionWidth will be negative if currentWrapperWidth = 0. Is it intentional? Also, please help explain why we need to introduce transactionWidth? Could we use transactionPreviewCarouselStyle.width instead of transactionWidth
There was a problem hiding this comment.
transactionWidth will be negative
It doesn't matter, since 0 is not greater than minimalWrapperWidth, then TRANSACTION_WIDTH_WIDE will just be applied.
Could we use transactionPreviewCarouselStyle.width
Yeah from what I see right now, I think it was use before I split transactionPreviewStyle into Carousel and Standalone styles, back then transactionPreviewStyle.width could be a CSS style string and I wanted to avoid this conflict; I guess we can switch it like you're proposing
There was a problem hiding this comment.
Oh right, missed that one because my comment was the last one - good catch!
| transactionPreviewCarouselStyle: {width: currentWrapperWidth > minimalWrapperWidth || currentWrapperWidth === 0 ? TRANSACTION_WIDTH_WIDE : transactionPreviewWidth}, | ||
| transactionPreviewStandaloneStyle: {width: `min(100%, ${TRANSACTION_WIDTH_WIDE}px)`, maxWidth: `min(100%, ${TRANSACTION_WIDTH_WIDE}px)`}, |
There was a problem hiding this comment.
Could you please give a comment to explain the meaning of the two styles?
There was a problem hiding this comment.
transactionPreviewCarouselStyle is a style applied to TransactionPreviews that are used inside of Carousel (MoneyRequestReportPreview) and transactionPreviewStandaloneStyle is a style applied to TransactionPreviews used with our the carousel, as standalone previews in Chats etc. These two need separate styles, because inside Carousel they need to be styled exactly by calculated value and without the Carousel they can base on CSS styles like 'width: 100%'
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
|
||
| const singleTransactionPreviewWidth = shouldUseNarrowLayout ? styles.w100.width : reportPreviewStyles.transactionPreviewStyle.width; | ||
| const singleTransactionPreviewStyles = [shouldUseNarrowLayout ? {...styles.w100, ...styles.mw100} : reportPreviewStyles.transactionPreviewStyle, styles.mt2]; | ||
| // Condition extracted from MoneyRequestPreview |
There was a problem hiding this comment.
What is the meaning of this comment?
There was a problem hiding this comment.
this condition was extracted from MoneyRequestPreview when it was replaced by TransactionPreview - it can be that it is redundant right now, but I can't really evaluate this, the comment is left so that it is clear where did it come from.
There was a problem hiding this comment.
@Guccio163 I can't find MoneyRequestPreview in our codebase anymore
There was a problem hiding this comment.
Yeah, that's exactly why the comment was left
There was a problem hiding this comment.
If that, I don't see any reason to keep this comment.
|
@Guccio163 The rest of the code change looks fine. Please ping me when you update the above comment and I will start on testing |
|
@Guccio163 Kindly bump |
|
@DylanDylann done 👍 |
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
OK, now should be done ✅ |
|
BUG (Not related to this PR): Not found page display when going to review duplicate page (only happens if we haven't opened the transaction) Screen.Recording.2025-06-26.at.14.10.11.mov |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-06-26.at.14.19.23.movAndroid: mWeb ChromeScreen.Recording.2025-06-26.at.14.14.21.moviOS: HybridAppScreen.Recording.2025-06-26.at.14.12.42.moviOS: mWeb SafariScreen.Recording.2025-06-26.at.14.11.59.movMacOS: Chrome / SafariScreen.Recording.2025-06-26.at.14.04.38.movMacOS: DesktopScreen.Recording.2025-06-26.at.14.16.02.mov |
+1, I've come across it too |
|
Waiting with this one for after our hackathon |
…-fork into Guccio163/MoneyRequestReportPreviewStylesCleanup
|
✋ 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: 9.1.73-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.73-0 🚀
|
Explanation of Change
This PR primarily fixes TransactionPreviews' style in Duplicates review section to rely on CSS styles and percentage width - this way it is ready right on the first render and the Transactions' list stay on top (doesn't scroll down). It also ensures that the rest of standalone TransactionPreview usages use similar design and refactors part of the code responsible for this.
Fixed Issues
$ #62988
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.mov
Android: mWeb Chrome
mWeb-android.mov
iOS: Native
ios.mov
iOS: mWeb Safari
mWeb-ios.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov