Skip to content

[Awaiting checklist completion] [CFI] [$250] Add the "Add expense" button to two areas of the product #68772

Closed

Description

@jamesdeanexpensify

Details

We'd like to add the Add expense button to two areas of New Expensify:

  1. Within reports that have multiple expenses
Image
  1. When viewing reports with no expenses from the Reports page
Image

cc @Expensify/design @JmillsExpensify @trjExpensify from here

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021958152712128088954
  • Upwork Job ID: 1958152712128088954
  • Last Price Increase: 2025-08-20
Issue OwnerCurrent Issue Owner: @brunovjk

Activity

  1. melvin-bot commented on Aug 19, 2025

    @melvin-bot

    Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  2. samranahm commented on Aug 19, 2025

    @samranahm
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Add the "Add expense" button to two areas of the product

    What is the root cause of that problem?

    new feat

    What changes do you think we should make in order to solve the problem?

    we want to add the Add expense button here

    MoneyRequestReportTotalSpend and TransactionGroupListItem

    like we did here in MoneyRequestReportPreviewContent

    <ButtonWithDropdownMenu
    onPress={() => {}}
    shouldAlwaysShowDropdownMenu
    customText={translate('iou.addExpense')}
    options={addExpenseDropdownOptions}
    isSplitButton={false}
    anchorAlignment={{
    horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
    vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
    }}
    />

    for MoneyRequestReportTransactionList we should add the dropDownButton in MoneyRequestReportTotalSpend that we display here

    <MoneyRequestReportTotalSpend
    hasComments={hasComments}
    isLoadingReportActions={!!isLoadingReportActions}
    isEmptyTransactions={isEmptyTransactions}
    totalDisplaySpend={totalDisplaySpend}
    report={report}
    hasPendingAction={hasPendingAction}
    />

    we should add the button in this view

    <View style={[styles.dFlex, styles.flexRow, styles.ph5, styles.justifyContentBetween, styles.mb2]}>

    like this

    <View style={[styles.dFlex, styles.flexRow, styles.ph5, styles.justifyContentBetween, styles.mb2]}> 
          <ButtonWithDropdownMenu
              onPress={() => {}}
              shouldAlwaysShowDropdownMenu
              customText={translate('iou.addExpense')}
              options={addExpenseDropdownOptions}
              isSplitButton={false}
              success={false}
              buttonSize={CONST.DROPDOWN_BUTTON_SIZE.SMALL}
          />
    1. and for transection list item we should include the ButtonWithDropdownMenu here

    <View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.mnh13]}>
    <Text
    style={[styles.textLabelSupporting]}
    numberOfLines={1}
    >
    {translate('search.moneyRequestReport.emptyStateTitle')}
    </Text>
    </View>

    like this

    <View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.mnh13]}>
        <Text
            style={[styles.textLabelSupporting, styles.mv4]}
            numberOfLines={1}
        >
            {translate('search.moneyRequestReport.emptyStateTitle')}
        </Text>
    
        <ButtonWithDropdownMenu
            onPress={() => {}}
            shouldAlwaysShowDropdownMenu
            customText={translate('iou.addExpense')}
            options={addExpenseDropdownOptions}
            isSplitButton={false}
            success={true}
            buttonSize={CONST.DROPDOWN_BUTTON_SIZE.SMALL}
            style={[styles.mb3]}
        />
    </View>

    we can use the anchorAlignment in MoneyRequestReportTotalSpend to display the model in right side to prevent overlapping the LHN

    anchorAlignment={{
      horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
      vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
    }}
    Image

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

    Transection list result

    Image

    Transection group list item

    Image
  3. Krishna2323 commented on Aug 19, 2025

    @Krishna2323
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Add the "Add expense" button to two areas of the product

    What is the root cause of that problem?

    New feat

    What changes do you think we should make in order to solve the problem?

    • We should add the add expense button in MoneyRequestReportTotalSpend or MoneyRequestReportTransactionList and in TransactionGroupListItem.
    • We should use isAddExpenseAction(report, transactions ?? [], isReportArchived) for conditionally rendering the button and follow the same approach as in MoneyReportHeader.
      if (isEmptyTransactions) {
      return (
      <>
      <SearchMoneyRequestReportEmptyState />
      <MoneyRequestReportTotalSpend
      hasComments={hasComments}
      isLoadingReportActions={!!isLoadingReportActions}
      isEmptyTransactions={isEmptyTransactions}
      totalDisplaySpend={totalDisplaySpend}
      report={report}
      hasPendingAction={hasPendingAction}
      />
      </>
      );
      }

      <MoneyRequestReportTotalSpend
      hasComments={hasComments}
      isLoadingReportActions={!!isLoadingReportActions}
      isEmptyTransactions={isEmptyTransactions}
      totalDisplaySpend={totalDisplaySpend}
      report={report}
      hasPendingAction={hasPendingAction}
      />

      <View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.mnh13]}>
      <Text
      style={[styles.textLabelSupporting]}
      numberOfLines={1}
      >
      {translate('search.moneyRequestReport.emptyStateTitle')}
      </Text>
      </View>

      const addExpenseDropdownOptions: Array<DropdownOption<ValueOf<typeof CONST.REPORT.ADD_EXPENSE_OPTIONS>>> = useMemo(
      () => [
      {
      value: CONST.REPORT.ADD_EXPENSE_OPTIONS.CREATE_NEW_EXPENSE,
      text: translate('iou.createExpense'),
      icon: Expensicons.Plus,
      onSelected: () => {
      if (!moneyRequestReport?.reportID) {
      return;
      }
      if (policy && shouldRestrictUserBillableActions(policy.id)) {
      Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id));
      return;
      }
      startMoneyRequest(CONST.IOU.TYPE.SUBMIT, moneyRequestReport?.reportID);
      },
      },
      {
      value: CONST.REPORT.ADD_EXPENSE_OPTIONS.ADD_UNREPORTED_EXPENSE,
      text: translate('iou.addUnreportedExpense'),
      icon: Expensicons.ReceiptPlus,
      onSelected: () => {
      if (policy && shouldRestrictUserBillableActions(policy.id)) {
      Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(policy.id));
      return;
      }
      openUnreportedExpense(moneyRequestReport?.reportID);
      },
      },
      ],
      [moneyRequestReport?.reportID, policy, translate],
      );

      [CONST.REPORT.PRIMARY_ACTIONS.ADD_EXPENSE]: (
      <ButtonWithDropdownMenu
      onPress={() => {}}
      shouldAlwaysShowDropdownMenu
      customText={translate('iou.addExpense')}
      options={addExpenseDropdownOptions}
      isSplitButton={false}
      />
      ),

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    Result

  4. Krishna2323 commented on Aug 19, 2025

    @Krishna2323
    Contributor

    PROPOSAL UPDATED

    • Added more references
  5. samranahm commented on Aug 19, 2025

    @samranahm
    Contributor

    Proposal updated

    • Added actual solution
  6. twisterdotcom commented on Aug 20, 2025

    @twisterdotcom
    Contributor

    I think this is a NewFeature, not a Bug @jamesdeanexpensify

  7. added
    NewFeatureSomething to build that is a new item.
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 20, 2025
  8. melvin-bot commented on Aug 20, 2025

    @melvin-bot

    Current assignee @twisterdotcom is eligible for the NewFeature assigner, not assigning anyone new.

  9. melvin-bot commented on Aug 20, 2025

    @melvin-bot

    ⚠️ It looks like this issue is labelled as a New Feature but not tied to any GitHub Project. Keep in mind that all new features should be tied to GitHub Projects in order to properly track external CAP software time ⚠️

  10. 99 remaining items

  11. changed the title [-][Due for payment 2025-10-31] [CFI] [$250] Add the "Add expense" button to two areas of the product[/-] [+][Awaiting checklist completion] [CFI] [$250] Add the "Add expense" button to two areas of the product[/+] on Oct 31, 2025
  12. brunovjk commented on Oct 31, 2025

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Not a bug. New feat

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition: Admin creates a workspace and invites 2 members.

    Test:

    • Test 1
    • Should have a report with some transactions and one with no transactions
    1. Open a report with some transactions
    2. Verify "Add expense" button is shown after the transaction list ends
    3. Add some transactions using the options in "Add expense" button dropdown
    4. Verify transaction is created and app navigates back correctly
    • Test 2
    1. Submit two expenses to any user.
    2. Open the expense report.
    3. Mention another user and send it.
    4. Click Invite to chat only.
    5. Open the expense report as the invited member.
    6. Verify add expense button is not shown for the invited member and the "Total" row is aligned to right
    • Test 3
    1. Go to workspace chat
    2. Go offline
    3. Create two expenses in workspace chat
    4. Open the expense report
    5. Verify the add expense button after transaction is is also greyed out
    • Test 4
    1. Go to workspace settings
    2. Tap more features & Enable per diem and upload per diem file
    3. Create a manual expense
    4. Create a per diem expense with large qty with maximum digits allowed to enter
    5. Tap add expense - Unreported expense
    6. Select a expense
    7. Tap add to report
    8. Verify out of pocket, company spend and Total row is shown correctly without being cut out.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-539a-a814-5448-53a664cbe181
  13. brunovjk commented on Oct 31, 2025

    @brunovjk
    Contributor

    All yours @twisterdotcom. Thank you.

  14. Krishna2323 commented on Oct 31, 2025

    @Krishna2323
    Contributor

    Requested in ND.

  15. twisterdotcom commented on Nov 3, 2025

    @twisterdotcom
    Contributor

    Updated payment summary.

  16. JmillsExpensify commented on Nov 3, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @Krishna2323

  17. brunovjk commented on Nov 3, 2025

    @brunovjk
    Contributor

    Requested in ND.

  18. m-natarajan commented on Nov 3, 2025

    @m-natarajan

    @brunovjk Add expense button not displayed for empty reports in Reports > Reports. Is this expected or an potential issue?

    Recording.1867.mp4
  19. brunovjk commented on Nov 3, 2025

    @brunovjk
    Contributor

    I believe that's expected. #71267 (comment)

    cc: @Krishna2323 @trjExpensify

  20. m-natarajan commented on Nov 3, 2025

    @m-natarajan

    I believe that's expected. #71267 (comment)

    Ok, Noted. Thanks

  21. garrettmknight commented on Nov 4, 2025

    @garrettmknight
    Contributor

    $250 approved for @brunovjk

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

Metadata

Metadata

Labels

DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributorsNewFeatureSomething to build that is a new item.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions