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(earn): Update earn deposit entry point bottom sheet #6350

Merged
merged 9 commits into from
Dec 12, 2024

Conversation

finnian0826
Copy link
Contributor

@finnian0826 finnian0826 commented Dec 10, 2024

Description

Bottom sheet always shows when tapping deposit, options match designs

Test plan

Unit tests updated / added

Manual tests (ignore + by deposit, it has been changed to the coins, see image at very bottom for coins icon)

Case Allbridge Aave/Beefy
Has deposit token, same chain and different chain everythin-2 everything-1
Has deposit token and same chain same-chain-1 same-chain-2
Has deposit token and different chain different-chain-1 different-chain-2
Has only deposit token only-deposit only-deposit-2
Has same and different chain but not deposit token both-3 both-4
Has same chain but not deposit token same-3 same-4
Has different chain but not deposit token different-3 different-4
Has no tokens none-3 none-4

Coins icon for deposit:

Show transfer if deposit token is not cash-in (except for case where deposit, swap&deposit and cross-chain swap is shown):

Related issues

Backwards compatibility

Yes

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • N/A

const showSwap = !canSwapDeposit && (hasTokensOnSameNetwork || hasTokensOnOtherNetworks)
const showAdd = canAdd && !hasDepositToken
const showAddMore =
canAdd && hasDepositToken && !(hasTokensOnSameNetwork && hasTokensOnOtherNetworks)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for this case, where add isn't shown if a user can deposit and also has same AND differnet chain tokens.

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.93%. Comparing base (dbbb667) to head (79cad46).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main    #6350    +/-   ##
========================================
  Coverage   88.92%   88.93%            
========================================
  Files         735      735            
  Lines       31364    31402    +38     
  Branches     5515     5833   +318     
========================================
+ Hits        27892    27928    +36     
+ Misses       3427     3276   -151     
- Partials       45      198   +153     
Files with missing lines Coverage Δ
...c/earn/poolInfoScreen/BeforeDepositBottomSheet.tsx 100.00% <100.00%> (ø)
src/earn/poolInfoScreen/EarnPoolInfoScreen.tsx 93.71% <100.00%> (-0.11%) ⬇️
src/earn/types.ts 100.00% <ø> (ø)

... and 66 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbbb667...79cad46. Read the comment docs.

/>
)}
{(canSwapDeposit || hasDepositToken) &&
(showCrossChainSwap || showSwap || showAdd || showAddMore) && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should only show the message if something will show up beneath it

@finnian0826 finnian0826 marked this pull request as ready for review December 11, 2024 16:36
})
})

it('show bottom sheet correctly when Deposit button is tapped and depositTokenId does not have balance, can same and cross chain swap', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All these tests moved to BeforeDepositBottomSheet.test.tsx

canAdd && hasDepositToken && !(hasTokensOnSameNetwork && hasTokensOnOtherNetworks)
const showTransfer =
(!hasDepositToken && !hasTokensOnSameNetwork && !hasTokensOnOtherNetworks) ||
(!canAdd && !(hasDepositToken && hasTokensOnSameNetwork && hasTokensOnOtherNetworks))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Show transfer instead of add if the token is:

  • Not a cash-in token
  • Not this case (has deposit token, same chain and different chain tokens)

Copy link
Collaborator

@MuckT MuckT left a comment

Choose a reason for hiding this comment

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

👨‍🍳

@finnian0826 finnian0826 added this pull request to the merge queue Dec 12, 2024
Merged via the queue into main with commit fc9f085 Dec 12, 2024
15 checks passed
@finnian0826 finnian0826 deleted the finnian0826/act-1494 branch December 12, 2024 17:54
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.

2 participants