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 entrypoint #6233

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,8 @@
"entrypoint": {
"title": "Earn on your crypto",
"subtitle": "Deposit and earn",
"description": "Earn on your crypto assets when you lend through a liquidity pool"
"description": "Earn by lending your crypto assets in liquidity pools.",
"totalDepositAndEarnings": "Total Deposit & Earnings"
},
"enterAmount": {
"title": "How much would you like to deposit?",
Expand Down
1 change: 0 additions & 1 deletion src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ export enum EarnEvents {
earn_withdraw_add_gas_press = 'earn_withdraw_add_gas_press',
earn_info_learn_press = 'earn_info_learn_press',
earn_info_earn_press = 'earn_info_earn_press',
earn_active_pools_card_press = 'earn_active_pools_card_press',
earn_home_learn_more_press = 'earn_home_learn_more_press',
earn_pool_card_press = 'earn_pool_card_press',
earn_home_error_try_again = 'earn_home_error_try_again',
Expand Down
3 changes: 1 addition & 2 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ export type EarnDepositTxsReceiptProperties = Partial<ApproveTxReceiptProperties
}>

interface EarnEventsProperties {
[EarnEvents.earn_entrypoint_press]: undefined
[EarnEvents.earn_entrypoint_press]: { hasSuppliedPools: boolean }
[EarnEvents.earn_before_deposit_action_press]: {
action: BeforeDepositActionName
} & TokenProperties &
Expand Down Expand Up @@ -1626,7 +1626,6 @@ interface EarnEventsProperties {
[EarnEvents.earn_withdraw_add_gas_press]: EarnCommonProperties & { gasTokenId: string }
[EarnEvents.earn_info_learn_press]: undefined
[EarnEvents.earn_info_earn_press]: undefined
[EarnEvents.earn_active_pools_card_press]: undefined
[EarnEvents.earn_home_learn_more_press]: undefined
[EarnEvents.earn_pool_card_press]: {
poolAmount: string
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
[EarnEvents.earn_withdraw_add_gas_press]: `When the user doesn't have enough for gas and clicks on the button to add gas token`,
[EarnEvents.earn_info_learn_press]: `When the user taps 'Learn More' on the earn info page`,
[EarnEvents.earn_info_earn_press]: `When the user taps 'Start Earning' on the earn info page `,
[EarnEvents.earn_active_pools_card_press]: `When the user taps on the active pool card in discover tab.`,
[EarnEvents.earn_home_learn_more_press]: `When the user taps 'Learn more' on the earn home screen`,
[EarnEvents.earn_pool_card_press]: `When the user taps on a pool card`,
[EarnEvents.earn_home_error_try_again]: `When the user taps try again on the earn home screen after an error loading pools`,
Expand Down Expand Up @@ -661,4 +660,5 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
// [EarnEvents.earn_enter_amount_info_more_pools]: `When a user taps to see other Aave pools`,
// [EarnEvents.earn_exit_pool_press]: `When the user taps on the exit pool button from the earn card in discover tab`,
// [EarnEvents.earn_deposit_more_press]: `When the user taps deposit more button from the earn card in discover tab`,
// [EarnEvents.earn_active_pools_card_press]: `When the user taps on the active pool card in discover tab.`,
}
10 changes: 4 additions & 6 deletions src/dappsExplorer/TabDiscover.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,16 @@ describe('TabDiscover', () => {
},
})

const { getByTestId, queryByTestId } = render(
const { getByTestId } = render(
<Provider store={store}>
<MockedNavigator component={TabDiscover} />
</Provider>
)

expect(getByTestId('EarnEntrypoint')).toBeTruthy()
expect(queryByTestId('EarnActivePools')).toBeFalsy()
})

it('displays earn active pool if balance is not zero', () => {
it('displays EarnEntrypoint if balance is not zero', () => {
jest
.mocked(getFeatureGate)
.mockImplementation(
Expand All @@ -410,14 +409,13 @@ describe('TabDiscover', () => {
},
})

const { getByTestId, queryByTestId } = render(
const { getByTestId } = render(
<Provider store={store}>
<MockedNavigator component={TabDiscover} />
</Provider>
)

expect(queryByTestId('EarnEntrypoint')).toBeFalsy()
expect(getByTestId('EarnActivePools')).toBeTruthy()
expect(getByTestId('EarnEntrypoint')).toBeTruthy()
})
})
})
14 changes: 2 additions & 12 deletions src/dappsExplorer/TabDiscover.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { NativeStackScreenProps } from '@react-navigation/native-stack'
import BigNumber from 'bignumber.js'
import React, { useMemo, useState } from 'react'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { LayoutChangeEvent, StyleSheet, Text, View } from 'react-native'
import Animated, { useAnimatedScrollHandler, useSharedValue } from 'react-native-reanimated'
import { SafeAreaView } from 'react-native-safe-area-context'
import { useSelector } from 'react-redux'
import { DappFeaturedActions } from 'src/dappsExplorer/DappFeaturedActions'
import DiscoverDappsCard from 'src/dappsExplorer/DiscoverDappsCard'
import EarnActivePools from 'src/earn/EarnActivePools'
import EarnEntrypoint from 'src/earn/EarnEntrypoint'
import { Screens } from 'src/navigator/Screens'
import useScrollAwareHeader from 'src/navigator/ScrollAwareHeader'
import { StackParamList } from 'src/navigator/types'
import PointsDiscoverCard from 'src/points/PointsDiscoverCard'
import { earnPositionsSelector } from 'src/positions/selectors'
import Colors from 'src/styles/colors'
import { typeScale } from 'src/styles/fonts'
import { Spacing } from 'src/styles/styles'
Expand Down Expand Up @@ -43,12 +39,6 @@ function TabDiscover({ navigation }: Props) {
animationDistance: titleHeight * 0.33,
})

const pools = useSelector(earnPositionsSelector)
const poolsSupplied = useMemo(
() => pools.filter((pool) => new BigNumber(pool.balance).gt(0)).length,
[pools]
)

return (
<Animated.ScrollView
testID="DiscoverScrollView"
Expand All @@ -62,7 +52,7 @@ function TabDiscover({ navigation }: Props) {
</Text>
<DappFeaturedActions />
<PointsDiscoverCard />
{poolsSupplied > 0 ? <EarnActivePools /> : <EarnEntrypoint />}
<EarnEntrypoint />
<DiscoverDappsCard />
</View>
</SafeAreaView>
Expand Down
102 changes: 0 additions & 102 deletions src/earn/EarnActivePools.test.tsx

This file was deleted.

110 changes: 0 additions & 110 deletions src/earn/EarnActivePools.tsx

This file was deleted.

Loading
Loading