Skip to content

Add dropdown button to empty report#64924

Merged
mountiny merged 14 commits intoExpensify:mainfrom
software-mansion-labs:feature/kuba-nowakowski/Update-the-new-report-empty-state
Jul 9, 2025
Merged

Add dropdown button to empty report#64924
mountiny merged 14 commits intoExpensify:mainfrom
software-mansion-labs:feature/kuba-nowakowski/Update-the-new-report-empty-state

Conversation

@sumo-slonik
Copy link
Contributor

@sumo-slonik sumo-slonik commented Jun 25, 2025

Explanation of Change

Fixed Issues

$ #64730
PROPOSAL:

Tests

  1. Create a new report.
  2. Check if a dropdown appears under the "Empty state" text.
  3. Click it and check if there are options for "Add Expense" and "Add Unreported Expense."
  4. Add an expense.
  • Verify that no errors appear in the JS console

Offline tests

Unnesesary

QA Steps

Same as test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2025-06-27.at.19.17.38.mov
Android: mWeb Chrome
android.web.1.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
web.ios.mov
MacOS: Chrome / Safari
web.mac.mov
MacOS: Desktop
desktop.mov

@sumo-slonik sumo-slonik marked this pull request as ready for review June 27, 2025 17:18
@sumo-slonik sumo-slonik requested a review from a team as a code owner June 27, 2025 17:18
@melvin-bot melvin-bot bot requested review from jjcoffee and removed request for a team June 27, 2025 17:18
@melvin-bot
Copy link

melvin-bot bot commented Jun 27, 2025

@jjcoffee 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]

@jjcoffee
Copy link
Contributor

jjcoffee commented Jun 28, 2025

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android-app-2025-07-02_21.17.43.mp4
Android: mWeb Chrome
android-chrome-2025-07-02_21.22.45.mp4
iOS: HybridApp
iOS: mWeb Safari
ios-safari-2025-07-02_21.35.18.mp4
MacOS: Chrome / Safari
desktop-chrome-2025-07-02_20.37.03.mp4
MacOS: Desktop
desktop-app-2025-07-02_20.45.09.mp4

@jjcoffee
Copy link
Contributor

Remove the primary action button Add expense from the report header and instead move it to the report empty state.

From the issue, it looks like the button in the header should also be removed, or am I missing some extra context?

@mountiny
Copy link
Contributor

@jjcoffee @sumo-slonik can you please add screenshots to explain what exactly you mean? cc @flaviadefaria @trjExpensify @JmillsExpensify

@mountiny mountiny self-requested a review June 30, 2025 07:51
@sumo-slonik
Copy link
Contributor Author

sumo-slonik commented Jun 30, 2025

@jjcoffee Yes, you're right, I'm removing it from the header now.

@trjExpensify
Copy link
Contributor

👋 I think the dropdown button looks good, but I think the idea was to remove the "Add expense" primary action button in the header now in light of adding it there. I noticed it's still visible in the OP video:

image

Also just checking that it is in fact inside the More menu now too in the empty state?

@sumo-slonik
Copy link
Contributor Author

I was busy today fixing a deploy blocker in navigation, I'll take care of this tomorrow.

@sumo-slonik
Copy link
Contributor Author

@trjExpensify @jjcoffee It seems to me that everything is as it should be now:

Screen.Recording.2025-07-01.at.12.52.08.mov

@trjExpensify
Copy link
Contributor

Yep!!

@sumo-slonik
Copy link
Contributor Author

@jjcoffee Do you think you'll have time to go over it?

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 2, 2025

@sumo-slonik Sure, I will get to it later today!

moneyRequestReport: {
emptyStateTitle: 'Este informe no tiene gastos.',
emptyStateSubtitle: 'Puedes añadir gastos a este informe usando el botón de arriba.',
emptyStateSubtitle: 'Puedes agregar gastos a este informe\\n usando el botón de abajo o la opción "Agregar gasto" en el menú Más de arriba.',

This comment was marked as resolved.


const isPayActionWithAllExpensesHeld = isPrimaryPayAction(report, policy, reportNameValuePairs, isChatReportArchived) && hasOnlyHeldExpenses(report?.reportID);

if (isAddExpenseAction(report, reportTransactions, isChatReportArchived)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the isAddExpenseAction function itself too, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is still used in function getReportPreviewAction()

@jjcoffee

This comment was marked as resolved.

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 2, 2025

@sumo-slonik I get a crash whenever I open an expense report (even a non-empty one). Reproducible on main so it's not this PR, but I can't really test fully otherwise! Did you test with a HybridApp build?

ios-app-2025-07-02_21.47.07.mp4

@sumo-slonik
Copy link
Contributor Author

I'm getting back to this and taking care of the comments.

@sumo-slonik
Copy link
Contributor Author

@jjcoffee On main, I still can't create a report on android-native. I believe this issue is not related to my PR, especially since all the comments mentioned above have been addressed.
To test it, an ad-hoc build should probably be enough, as it seems to appear in dev builds (based on what I see in the issue).

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 4, 2025

@sumo-slonik Okay, thanks for looking into it! I have to finish for today soon, so I think we can wait until Monday and hope the issue is resolved.

@mountiny
Copy link
Contributor

mountiny commented Jul 4, 2025

@jjcoffee can you please also test on main to ensure its not specific to this PR? thanks!

@sumo-slonik can you please sync up with main? thanks!

@mountiny
Copy link
Contributor

mountiny commented Jul 7, 2025

@jjcoffee all yours

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 7, 2025

I can still repro the crash, but also on main, so maybe we should just proceed?

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 7, 2025

For this, it feels a bit awkward to only scroll the empty view. I think it might make more sense to scroll the whole view, the same as what happens if you send a message on the report.

ios-safari-scroll-2025-07-07_15.44.38.mp4

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 7, 2025

Reported the crash here. Looks like it's a known issue, see #65268.

@sumo-slonik
Copy link
Contributor Author

For #64924 (comment), it feels a bit awkward to only scroll the empty view. I think it might make more sense to scroll the whole view, the same as what happens if you send a message on the report.

I think I can do it that way. The other solution felt more intuitive to me, since the empty screen appears in more than one scenario in the reports, so wrapping just that part in a ScrollView seemed less invasive. However, doing it at the level of the entire report will definitely be more consistent. I’ll take care of it today.

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 8, 2025

Let me just get a gut check from @Expensify/design on this. Does it make sense to scroll the empty view separately from the list of (custom) report fields? I'm unsure if we do it elsewhere in the app, and my concern would be that if there are even more fields, we'd end up scrolling a tiny space where the empty view sits.

@dubielzyk-expensify
Copy link
Contributor

My expectation would be that the whole view scroll like in the video attached in the comment. Would like a gut check from @shawnborton and @dannymcclain though.

@jjcoffee
Copy link
Contributor

jjcoffee commented Jul 8, 2025

@sumo-slonik Do you think it's worth splitting this out into a separate issue? It's not anything introduced by this PR, other than that the empty view is slightly longer due to the button.

@shawnborton
Copy link
Contributor

Totally agree with Jon there - it should behave like any other report where the space between the fixed top header and the fixed bottom composer is what scrolls.

@dannymcclain
Copy link
Contributor

Agree with Shawn and Jon!

@sumo-slonik
Copy link
Contributor Author

I was dealing with deployment blockers yesterday. I'm getting back to it now

@sumo-slonik
Copy link
Contributor Author

@sumo-slonik Do you think it's worth splitting #64924 (comment) out into a separate issue? It's not anything introduced by this PR, other than that the empty view is slightly longer due to the button.

I don't think there's any reason to split it into separate PR. I'll do it today as part of this PR and let you know when it's ready.

@sumo-slonik
Copy link
Contributor Author

sumo-slonik commented Jul 9, 2025

@jjcoffee I think it's finally working as it should:

Screen.Recording.2025-07-09.at.11.13.57.mov

Copy link
Contributor

@jjcoffee jjcoffee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

type MoneyRequestReportTransactionListProps = {
report: OnyxTypes.Report;

policy?: OnyxTypes.Policy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs

value: CONST.REPORT.ADD_EXPENSE_OPTIONS.ADD_UNREPORTED_EXPENSE,
text: translate('iou.addUnreportedExpense'),
icon: Expensicons.ReceiptPlus,
onSelected: () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be here too?

Suggested change
onSelected: () => {
onSelected: () => {
if (!reportId) {
return;
}

@mountiny mountiny merged commit 81ec9fc into Expensify:main Jul 9, 2025
19 checks passed
@OSBotify
Copy link
Contributor

OSBotify commented Jul 9, 2025

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.79-0 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@github-actions
Copy link
Contributor

🚀 Deployed to production by https://github.com/Julesssss in version: 9.1.79-11 🚀

platform result
🖥 desktop 🖥 success ✅
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants