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): Add Claiming Reward line item on enter amount screen #6169

Merged
merged 70 commits into from
Oct 21, 2024

Conversation

finnian0826
Copy link
Contributor

@finnian0826 finnian0826 commented Oct 17, 2024

Description

Show line items for each reward that will be claimed

Also, only show Withdrawing and Claiming card if there are rewards that will be claimed

Test plan

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:

  • Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

MuckT and others added 30 commits October 2, 2024 15:08
# Conflicts:
#	src/earn/EarnDepositBottomSheet.tsx
Co-authored-by: Finnian Jacobson-Schulte <[email protected]>
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.88%. Comparing base (6e03eb4) to head (68e6ade).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6169      +/-   ##
==========================================
+ Coverage   88.86%   88.88%   +0.01%     
==========================================
  Files         728      730       +2     
  Lines       30997    31037      +40     
  Branches     5689     5390     -299     
==========================================
+ Hits        27546    27587      +41     
- Misses       3255     3408     +153     
+ Partials      196       42     -154     
Files with missing lines Coverage Δ
src/earn/EarnEnterAmount.tsx 89.42% <100.00%> (+0.26%) ⬆️

... and 75 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 6e03eb4...68e6ade. Read the comment docs.

Base automatically changed from finnian0826/act-1411 to main October 18, 2024 18:20
@finnian0826 finnian0826 marked this pull request as ready for review October 18, 2024 20:27
Comment on lines 289 to 291
const rewardsPositions = useSelector(positionsWithBalanceSelector).filter((position) =>
pool.dataProps.rewardsPositionIds?.includes(position.positionId)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we do the filter inside a useMemo?

expect(getByTestId('EarnEnterAmount/Reward-0-crypto')).toHaveTextContent('0.01 ARB')
})

it('should show the Withdrawing and Claiming card if withdrawalIncludesClaim is true', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should show the Withdrawing and Claiming card if withdrawalIncludesClaim is true', async () => {
it('should show the Withdrawing and Claiming card if withdrawalIncludesClaim is true', async () => {

@@ -619,6 +632,33 @@ function TransactionWithdrawDetails({
</Text>
</View>
</View>
{pool.dataProps.withdrawalIncludesClaim &&
rewardsPositions.map((position, index) => (
<View key={index} style={styles.txDetailsLineItem}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're using this pattern in a few places in the earn flow we should abstract it to a reusable component, but that can be separate from this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

might be a bit tricky since some show crypto amount in parentheses but some don't, some have multiple line items to be shown but some don't. I can make a follow-up ticket for cleanup if that would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -286,6 +286,16 @@ function EarnEnterAmount({ route }: Props) {
prepareTransactionsResult.type === 'possible' &&
prepareTransactionsResult.transactions.length > 0

const allRewardsPositions = useSelector(positionsWithBalanceSelector)
Copy link
Contributor

Choose a reason for hiding this comment

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

these are not all rewards right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, updated to allPositionsWithBalance in 68e6ade

@finnian0826 finnian0826 added this pull request to the merge queue Oct 21, 2024
Merged via the queue into main with commit c25833a Oct 21, 2024
15 checks passed
@finnian0826 finnian0826 deleted the finnian0826/act-1411-2 branch October 21, 2024 18:40
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.

3 participants