Skip to content
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

[Pending/Scanning pattern] Update the UI for Pending and Scanning in Single Transaction ReportPreview / MoneyRequestAction #40020

Conversation

BrtqKr
Copy link
Contributor

@BrtqKr BrtqKr commented Apr 10, 2024

Details

Fixed Issues

$ #38688
PROPOSAL:

Tests

Prerequisites:

  1. Extract transaction id from one of the ReportPreview components
  2. Mock pending transaction using code below
Onyx.merge('cardList', {
        4: {
            bank: 'Expensify Card',
            lastFourPAN: 3458,
        },
    });
    Onyx.merge('transactions_6788826100220673669', {
        amount: 1000,
        currency: 'USD',
        cardID: 4,
        modifiedMerchant: null,
        merchant: 'Test ECard Transaction',
        mccGroup: 'Airlines',
        hasEReceipt: true,
        receipt: {},
        reimbursable: false,
        status: 'Pending',
    });
  1. Check the preview component visible on the highest level of the report
  2. Press the preview and enter the transaction details. Check the header attachment and the preview text.
  3. Create a receipt scan and go through steps 1 and 2 for that type of action while the receipt is being processed.

The

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • 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 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 the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • 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 verified the translation was requested/reviewed 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.js 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.
  • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari Screenshot 2024-04-11 at 14 51 50 Screenshot 2024-04-11 at 14 52 03 Screenshot 2024-04-11 at 14 52 13 Screenshot 2024-04-11 at 14 52 24 Screenshot 2024-04-11 at 14 55 03 Screenshot 2024-04-11 at 14 55 07 Screenshot 2024-04-11 at 14 55 27 Screenshot 2024-04-11 at 14 55 32
MacOS: Desktop Screenshot 2024-04-30 at 10 27 26 Screenshot 2024-04-30 at 10 29 01 Screenshot 2024-04-30 at 10 29 06 Screenshot 2024-04-30 at 10 30 05

ios/Podfile.lock Outdated Show resolved Hide resolved
@BrtqKr BrtqKr marked this pull request as ready for review April 12, 2024 08:59
@BrtqKr BrtqKr requested review from a team as code owners April 12, 2024 08:59
@melvin-bot melvin-bot bot requested review from dannymcclain and thesahindia and removed request for a team April 12, 2024 08:59
Copy link

melvin-bot bot commented Apr 12, 2024

@dannymcclain @thesahindia One of you needs to 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]

@shawnborton
Copy link
Contributor

Looks like we're missing a display name here before " spent:"
CleanShot 2024-04-12 at 14 31 36@2x

width={variables.iconSizeExtraSmall}
fill={theme.textSupporting}
/>
<Text style={[styles.textLabel, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>{translate('iou.receiptScanInProgress')}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the preview card view? If so, just want to check that we're using the correct font size for that, cc @dannymcclain

If I recall, we had a slightly smaller size on the preview card, but we use label on the actual report header.

Copy link
Contributor

Choose a reason for hiding this comment

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

We do indeed use slightly different sizing in the preview vs. the header. Here's the spec reference:

image

width={variables.iconSizeExtraSmall}
fill={theme.textSupporting}
/>
<Text style={[styles.textLabel, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>{translate('iou.receiptScanInProgress')}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment as above here

@BrtqKr
Copy link
Contributor Author

BrtqKr commented Apr 15, 2024

Looks like we're missing a display name here before " spent:" CleanShot 2024-04-12 at 14 31 36@2x

@shawnborton I haven't changed anything in the display logic for that part, so it's either because of missing info from the mocked transaction or a separate bug.

@BrtqKr BrtqKr requested a review from shawnborton April 15, 2024 09:57
width={variables.iconSizeExtraSmall}
fill={theme.textSupporting}
/>
<Text style={[styles.textMicroSupporting, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

colorMuted here is unnecessary, right? Since we already cover this in the textMicroSupporting styles:
CleanShot 2024-04-15 at 13 27 59@2x

width={variables.iconSizeExtraSmall}
fill={theme.textSupporting}
/>
<Text style={[styles.textMicroSupporting, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>
Copy link
Contributor

Choose a reason for hiding this comment

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

colorMuted here is unnecessary, right? Since we already cover this in the textMicroSupporting styles:
CleanShot 2024-04-15 at 13 27 59@2x

@BrtqKr BrtqKr requested a review from ishpaul777 May 9, 2024 08:42
Copy link
Contributor

@ishpaul777 ishpaul777 left a comment

Choose a reason for hiding this comment

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

LGTM!

@melvin-bot melvin-bot bot requested a review from grgia May 9, 2024 17:59
@yuwenmemon
Copy link
Contributor

Looks good, let's merge this tomorrow 👍

@yuwenmemon yuwenmemon changed the title [Pending/Scanning pattern] Update the UI for Pending and Scanning in Single Transaction ReportPreview / MoneyRequestAction [HOLD Merge Freeze] [Pending/Scanning pattern] Update the UI for Pending and Scanning in Single Transaction ReportPreview / MoneyRequestAction May 9, 2024
@ishpaul777
Copy link
Contributor

ah, translation confirmation is still pending @yuwenmemon can you please bump https://expensify.slack.com/archives/C01GTK53T8Q/p1715166633822739 internally ?

@yuwenmemon
Copy link
Contributor

Ah yes! Done!

Copy link
Contributor

@yuwenmemon yuwenmemon left a comment

Choose a reason for hiding this comment

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

Added in the proper translations as suggestions.

@@ -640,15 +640,17 @@ export default {
deleteReceipt: 'Eliminar recibo',
receiptIssuesFound: (count: number) => `${count === 1 ? 'Problema encontrado' : 'Problemas encontrados'}`,
fieldPending: 'Pendiente...',
receiptScanning: 'Escaneando recibo...',
receiptScanInProgress: 'Escaneo en curso.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
receiptScanInProgress: 'Escaneo en curso.',
receiptScanInProgress: 'Escaneado de recibo en proceso.',

@@ -640,15 +640,17 @@ export default {
deleteReceipt: 'Eliminar recibo',
receiptIssuesFound: (count: number) => `${count === 1 ? 'Problema encontrado' : 'Problemas encontrados'}`,
fieldPending: 'Pendiente...',
receiptScanning: 'Escaneando recibo...',
receiptScanInProgress: 'Escaneo en curso.',
receiptScanInProgressDescription: 'Escaneando recibo. Vuelva a comprobarlo más tarde o introduzca los detalles ahora.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
receiptScanInProgressDescription: 'Escaneando recibo. Vuelva a comprobarlo más tarde o introduzca los detalles ahora.',
receiptScanInProgressDescription: 'Escaneado de recibo en proceso. Vuelva a comprobar más tarde o introduzca los detalles ahora.',

receiptMissingDetails: 'Recibo con campos vacíos',
missingAmount: 'Falta importe',
missingMerchant: 'Falta comerciante',
receiptStatusTitle: 'Escaneando…',
receiptStatusText: 'Solo tú puedes ver este recibo cuando se está escaneando. Vuelve más tarde o introduce los detalles ahora.',
receiptScanningFailed: 'El escaneo de recibo ha fallado. Introduce los detalles manualmente.',
transactionPendingText: 'La transacción tarda unos días en contabilizarse desde la fecha en que se utilizó la tarjeta.',
transactionPendingDescription: 'Transacción pendiente. Esto puede tardar algunos días en registrarse a partir de la fecha en que se utilizó la tarjeta.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
transactionPendingDescription: 'Transacción pendiente. Esto puede tardar algunos días en registrarse a partir de la fecha en que se utilizó la tarjeta.',
transactionPendingDescription: 'Transacción pendiente. La transacción tarda unos días en contabilizarse desde la fecha en que se utilizó la tarjeta.',

@@ -752,6 +754,7 @@ export default {
set: 'estableció',
changed: 'cambió',
removed: 'eliminó',
transactionPending: 'Transacción pendiente.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
transactionPending: 'Transacción pendiente.',
transactionPending: 'Transacción pendiente.',

@yuwenmemon yuwenmemon changed the title [HOLD Merge Freeze] [Pending/Scanning pattern] Update the UI for Pending and Scanning in Single Transaction ReportPreview / MoneyRequestAction [Pending/Scanning pattern] Update the UI for Pending and Scanning in Single Transaction ReportPreview / MoneyRequestAction May 10, 2024
@BrtqKr BrtqKr requested a review from yuwenmemon May 10, 2024 08:13
Copy link
Contributor

@yuwenmemon yuwenmemon left a comment

Choose a reason for hiding this comment

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

LGTM!

@yuwenmemon yuwenmemon merged commit 9609739 into Expensify:main May 10, 2024
15 checks passed
@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 1.4.73-0 🚀

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

@kbecciv
Copy link

kbecciv commented May 13, 2024

@BrtqKr Can you please share the QA steps?

@ishpaul777
Copy link
Contributor

ishpaul777 commented May 13, 2024

Prerequisites:

  1. Submit expense in workspace, open expense detail, click on any field to edit copy transaction id from url
Screenshot 2024-05-13 at 6 01 25 PM
  1. Mock pending transaction executing this code in console:
Onyx.merge('cardList', {
        4: {
            bank: 'Expensify Card',
            lastFourPAN: 3458,
        },
    });
    Onyx.merge(`transactions_(replace this with transaction id you copied from 1st step here)`, {
        amount: 1000,
        currency: 'USD',
        cardID: 4,
        modifiedMerchant: null,
        merchant: 'Test ECard Transaction',
        mccGroup: 'Airlines',
        hasEReceipt: true,
        receipt: {},
        reimbursable: false,
        status: 'Pending',
    });

Test Steps:

  1. Check the preview component visible on the highest level of the report
    2.Press the preview and enter the transaction details. Check the header attachment and the preview text. ( see screenshots in PR details for reference)
  2. Create a receipt scan and go through steps 1 and 2 for that type of action while the receipt is being processed. ( see screenshots for referece)

@ishpaul777
Copy link
Contributor

@kbecciv Above are QA test steps

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/Beamanator in version: 1.4.73-7 🚀

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

@dangrous
Copy link
Contributor

dangrous commented May 28, 2024

Hi friends! Can I get a quick explanation of why we included && !action.pendingAction in isWhisper here?

const isWhisper = whisperedTo.length > 0 && transactionsWithReceipts.length === 0 && !action.pendingAction;

It's causing this bug with new functionality (allowing flagging of whispers) and I'm wondering if we need it. Do you recall what the reasoning was for not having pending actions count as whispers?

Thanks!

@dangrous
Copy link
Contributor

dangrous commented Jun 4, 2024

Bump @BrtqKr and anyone else who might know - am I safe to remove that pendingAction check above? I'm not sure why it exists currently, but I might be missing something. Thanks!

@ishpaul777
Copy link
Contributor

Hello @dangrous, sorry for delayed response, I really dont recall the purpose for pendingAction but l did breief testing removing this i dont notice any issues as such, @BrtqKr would be able to clarify this best if we need this at all.

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

Successfully merging this pull request may close these issues.