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

[HOLD for payment 2024-05-02] [$750] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput #40382

Closed
youssef-lr opened this issue Apr 17, 2024 · 23 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@youssef-lr
Copy link
Contributor

youssef-lr commented Apr 17, 2024

Problem

the MoneyRequestAmountForm is currently designed to be used from the Amount pages where it is displayed in a view that takes up the whole page, and has specific style for that. We'd like to reuse this input without any extra style and be able to re-style it with ease.

Solution

Decouple the logic that handles accepting and formatting amounts from MoneyRequestAmountForm, by creating a new MoneyRequestAmountInput that doesn't have any custom styles and looks like a basic input.

  1. Move all the logic for handling input from MoneyRequestAmountForm into the new input.
  2. The MoneyRequestAmountForm should only keep navigation and form logic.
  3. The input should have a new callback onAmountChange that can be used by parent components.
  4. Display currency as part of the input as in the mocks. For this we can simply use the prefixCharacter that should be prop drilled into the underlying TextInput used in this component. We will need to configure the padding of the prefix text to accomodate for both single character currencies and 3 characters currencies. (e.g. $ and AED). Since the prefix is absolutely positioned, this is necessary.
  5. The new input should accept styles so that it can be reused from the Amount full pages, e.g. no borders, increased font, etc.

Here's a mock of how the input should look like when used from the Splits page:

Screenshot 2024-04-17 at 22 13 15
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f6b340c95c53b510
  • Upwork Job ID: 1780706666038550528
  • Last Price Increase: 2024-04-30
  • Automatic offers:
    • hungvu193 | Reviewer | 0
    • ZhenjaHorbach | Contributor | 0
@youssef-lr youssef-lr added External Added to denote the issue can be worked on by a contributor Bug Something is broken. Auto assigns a BugZero manager. labels Apr 17, 2024
@youssef-lr youssef-lr self-assigned this Apr 17, 2024
@melvin-bot melvin-bot bot changed the title [CRITICAL] Make MoneyRequestAmountForm reusable and stylable [$250] [CRITICAL] Make MoneyRequestAmountForm reusable and stylable Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01f6b340c95c53b510

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (External)

Copy link

melvin-bot bot commented Apr 17, 2024

Triggered auto assignment to @jliexpensify (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.

@melvin-bot melvin-bot bot added the Daily KSv2 label Apr 17, 2024
@youssef-lr youssef-lr changed the title [$250] [CRITICAL] Make MoneyRequestAmountForm reusable and stylable [$500] [CRITICAL] Make MoneyRequestAmountForm reusable and stylable Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

Upwork job price has been updated to $500

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 17, 2024

Proposal

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

CRITICAL] Make MoneyRequestAmountForm reusable and stylable

What is the root cause of that problem?

New feature

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

To fix this issue we need make changes following instructions

For this we need make MoneyRequestAmountInput for this input using input from MoneyRequestAmountForm

<TextInputWithCurrencySymbol
formattedAmount={formattedAmount}
onChangeAmount={setNewAmount}
onCurrencyButtonPress={onCurrencyButtonPress}
placeholder={numberFormat(0)}
ref={(ref) => {
if (typeof forwardedRef === 'function') {
forwardedRef(ref);
} else if (forwardedRef?.current) {
// eslint-disable-next-line no-param-reassign
forwardedRef.current = ref;
}
textInput.current = ref;
}}
selectedCurrencyCode={currency}
selection={selection}
onSelectionChange={(e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => {
if (!shouldUpdateSelection) {
return;
}
const maxSelection = formattedAmount.length;
const start = Math.min(e.nativeEvent.selection.start, maxSelection);
const end = Math.min(e.nativeEvent.selection.end, maxSelection);
setSelection({start, end});
}}
onKeyPress={textInputKeyPress}
isCurrencyPressable={isCurrencyPressable}
/>

Also we need remove some function from MoneyRequestAmountForm and use them inside MoneyRequestAmountInput

And if necessary, add a few new parameters

What alternative solutions did you explore? (Optional)

NA

@youssef-lr
Copy link
Contributor Author

@ZhenjaHorbach Are you able to give this your top priority? The deadline is very tight for this one, if yes, I'm happy to assign you!

@ZhenjaHorbach
Copy link
Contributor

@ZhenjaHorbach Are you able to give this your top priority? The deadline is very tight for this one, if yes, I'm happy to assign you!

I can start right now
And the maximum time for the PR to be ready is tomorrow

@youssef-lr youssef-lr changed the title [$500] [CRITICAL] Make MoneyRequestAmountForm reusable and stylable [$500] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput Apr 17, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 17, 2024
Copy link

melvin-bot bot commented Apr 17, 2024

📣 @hungvu193 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@youssef-lr
Copy link
Contributor Author

That sounds good!

Copy link

melvin-bot bot commented Apr 17, 2024

📣 @ZhenjaHorbach 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@youssef-lr
Copy link
Contributor Author

@ZhenjaHorbach do you mind letting me know your Slack handle?

@ZhenjaHorbach
Copy link
Contributor

@ZhenjaHorbach do you mind letting me know your Slack handle?

Here it is)

HorbachY

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 18, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Apr 25, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Apr 25, 2024
@melvin-bot melvin-bot bot changed the title [$500] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput [HOLD for payment 2024-05-02] [$500] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput Apr 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Apr 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.65-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-05-02. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 25, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@hungvu193] The PR that introduced the bug has been identified. Link to the PR:
  • [@hungvu193] 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:
  • [@hungvu193] A discussion in #expensify-bugs 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:
  • [@hungvu193] Determine if we should create a regression test for this bug.
  • [@hungvu193] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@hungvu193
Copy link
Contributor

This new feature so I don't think we need regression test for this one.

@youssef-lr youssef-lr changed the title [HOLD for payment 2024-05-02] [$500] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput [HOLD for payment 2024-05-02] [$750] [CRITICAL] Create a reusable and stylable MoneyRequestAmountInput Apr 30, 2024
Copy link

melvin-bot bot commented Apr 30, 2024

Upwork job price has been updated to $750

@youssef-lr
Copy link
Contributor Author

@jliexpensify increasing bounty here as @ZhenjaHorbach has been very kind to help out with styling the input further for my specific use case.

@jliexpensify
Copy link
Contributor

jliexpensify commented Apr 30, 2024

No worries, here's an updated Summary:

Upwork job

@youssef-lr
Copy link
Contributor Author

C+ should remain $500 in this case, this was extra work outside the PR from @ZhenjaHorbach.

@jliexpensify
Copy link
Contributor

jliexpensify commented Apr 30, 2024

Ah, thanks for clarifying - fixed!

@youssef-lr
Copy link
Contributor Author

Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 1, 2024
@jliexpensify
Copy link
Contributor

jliexpensify commented May 2, 2024

All paid and job removed! @ZhenjaHorbach I've given you a $250 bonus, so you'll get $750 all up.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

4 participants