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

feat: add max tooltip for staking with gas fee consideration #12025

Merged
merged 34 commits into from
Oct 29, 2024

Conversation

amitabh94
Copy link
Contributor

@amitabh94 amitabh94 commented Oct 25, 2024

Description

This PR renders the max input modal component when the user clicks on the max button on the stake input screen. This is also responsible for subtracting the gas fees from the available balance before letting the user continue to the deposit flow.

This PR also makes some minor changes and refactors as described below:

  • Fixes the misaligned staking navbar on Android devices.
  • The claim stake button will now be disabled until the transaction-controllers has closed. This prevents users from initiating multiple claims simultaneously.

Related issues

Fixes: STAKE-847

Manual testing steps

  1. Add export MM_POOLED_STAKING_UI_ENABLED=true to .js.env file.
  2. Click on Earn CTA
  3. Click on Max button
  4. Max input bottom sheet should appear and clicking on use max will calculate the maximum amount that can be staked by subtracting gas fees.

Screenshots/Recordings

New : Max Input Modal

Max_Input_Modal.mp4

Navbar alignment Fix

Before

image

After

image

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@amitabh94 amitabh94 force-pushed the STAKE-847--fe-add-max-tooltip branch from 14b2fc1 to bb52808 Compare October 25, 2024 05:30
@amitabh94 amitabh94 force-pushed the STAKE-847--fe-add-max-tooltip branch from bb52808 to 14b3fb9 Compare October 25, 2024 19:48
@amitabh94 amitabh94 force-pushed the STAKE-847--fe-add-max-tooltip branch from a737356 to fd5aee6 Compare October 26, 2024 06:32
@amitabh94 amitabh94 added team-stake Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 26, 2024
Copy link
Contributor

github-actions bot commented Oct 26, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 0bbf6d4
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/89714ed1-6100-4245-80c0-83a714a8dbe9

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@codecov-commenter
Copy link

codecov-commenter commented Oct 26, 2024

Codecov Report

Attention: Patch coverage is 69.65517% with 44 lines in your changes missing coverage. Please review.

Project coverage is 55.53%. Comparing base (ead35c4) to head (c886d86).
Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
app/components/UI/Stake/hooks/useUnstakingInput.ts 76.00% 9 Missing and 3 partials ⚠️
...Balance/StakingBanners/ClaimBanner/ClaimBanner.tsx 41.17% 9 Missing and 1 partial ⚠️
app/components/UI/Stake/hooks/useStakingGasFee.ts 75.00% 5 Missing and 4 partials ⚠️
app/components/UI/Stake/hooks/useStakingInput.ts 35.71% 8 Missing and 1 partial ⚠️
...pp/components/UI/Stake/components/QuickAmounts.tsx 57.14% 2 Missing and 1 partial ⚠️
...s/UI/Stake/Views/StakeInputView/StakeInputView.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12025      +/-   ##
==========================================
+ Coverage   55.35%   55.53%   +0.18%     
==========================================
  Files        1767     1776       +9     
  Lines       39841    40058     +217     
  Branches     4965     4987      +22     
==========================================
+ Hits        22052    22248     +196     
- Misses      16274    16285      +11     
- Partials     1515     1525      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amitabh94 amitabh94 force-pushed the STAKE-847--fe-add-max-tooltip branch from 0bbf6d4 to e702374 Compare October 28, 2024 17:20
@amitabh94 amitabh94 marked this pull request as ready for review October 29, 2024 16:38
@amitabh94 amitabh94 requested review from a team as code owners October 29, 2024 16:38
@amitabh94 amitabh94 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 29, 2024
Copy link
Contributor

github-actions bot commented Oct 29, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 134e0e2
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/317e0957-1917-4c6f-b803-79a58843356d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

gambinish
gambinish previously approved these changes Oct 29, 2024
Matt561
Matt561 previously approved these changes Oct 29, 2024
Copy link
Contributor

@Matt561 Matt561 left a comment

Choose a reason for hiding this comment

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

1 minor comment but otherwise LGTM! Awesome work 🚀

app/components/UI/Stake/hooks/useStakingInput.ts Outdated Show resolved Hide resolved
@amitabh94 amitabh94 dismissed stale reviews from Matt561 and gambinish via 1ce4838 October 29, 2024 17:05
@Matt561 Matt561 self-requested a review October 29, 2024 17:05
@amitabh94 amitabh94 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Oct 29, 2024
@amitabh94 amitabh94 enabled auto-merge October 29, 2024 17:10
Copy link
Contributor

github-actions bot commented Oct 29, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 1ce4838
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/4e1c1e89-6826-4fc4-9edc-38f223a82331

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link

Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

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

LGTM

@amitabh94 amitabh94 added this pull request to the merge queue Oct 29, 2024
Merged via the queue into main with commit 82aec27 Oct 29, 2024
43 checks passed
@amitabh94 amitabh94 deleted the STAKE-847--fe-add-max-tooltip branch October 29, 2024 18:03
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2024
@metamaskbot metamaskbot added the release-7.35.0 Issue or pull request that will be included in release 7.35.0 label Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.35.0 Issue or pull request that will be included in release 7.35.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-stake
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants