-
Notifications
You must be signed in to change notification settings - Fork 97
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
Conversation
# Conflicts: # src/earn/EarnDepositBottomSheet.tsx
Co-authored-by: Finnian Jacobson-Schulte <140328381+finnian0826@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ 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
... and 75 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
src/earn/EarnEnterAmount.tsx
Outdated
const rewardsPositions = useSelector(positionsWithBalanceSelector).filter((position) => | ||
pool.dataProps.rewardsPositionIds?.includes(position.positionId) | ||
) |
There was a problem hiding this comment.
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
?
src/earn/EarnEnterAmount.test.tsx
Outdated
expect(getByTestId('EarnEnterAmount/Reward-0-crypto')).toHaveTextContent('0.01 ARB') | ||
}) | ||
|
||
it('should show the Withdrawing and Claiming card if withdrawalIncludesClaim is true', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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}> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/earn/EarnEnterAmount.tsx
Outdated
@@ -286,6 +286,16 @@ function EarnEnterAmount({ route }: Props) { | |||
prepareTransactionsResult.type === 'possible' && | |||
prepareTransactionsResult.transactions.length > 0 | |||
|
|||
const allRewardsPositions = useSelector(positionsWithBalanceSelector) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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: