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 earn withdraw bottom sheet #6142

Merged
merged 26 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
14 changes: 14 additions & 0 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,20 @@
"deposit": "Deposit",
"depositAndEarnings": "Deposit & Earnings",
"withdraw": "Withdraw",
"withdrawBottomSheet": {
"title": "Select withdraw type",
"withdrawAndClaim": "Withdraw and Claim",
"withdrawDescription": "Withdraw a specific amount of any tokens you have deposited in the pool",
"withdrawAndClaimDescription": "Withdraw a specific amount of any tokens you have deposited in the pool and claim your rewards automatically",
"claimRewards": "Claim Rewards",
"claimRewardsDescription": "Claim your rewards. Partial amounts of the reward cannot be claimed",
"claimEarnings": "Claim Earnings",
"claimEarningsDescription": "Claim the earnings on your deposit. Partial amounts cannot be claimed ",
finnian0826 marked this conversation as resolved.
Show resolved Hide resolved
"exit": "Exit",
"exitDescription": "Exiting will withdraw everything you have in the pool",
"exitWithRewardsDescription": "Exiting will withdraw everything you have in the pool, including rewards",
"exitWithEarningsDescription": "Exiting will withdraw everything you have in the pool, including earnings"
},
"totalDepositAndEarnings": "Total Deposit & Earnings",
"titleLocalAmountDisplay": "{{localCurrencySymbol}}{{localCurrencyAmount}}",
"lineItemAmountDisplay": "{{localCurrencySymbol}}{{localCurrencyAmount}} ({{cryptoAmount}} {{cryptoSymbol}})",
Expand Down
1 change: 1 addition & 0 deletions src/analytics/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,4 +682,5 @@ export enum EarnEvents {
earn_pool_info_tap_info_icon = 'earn_pool_info_tap_info_icon',
earn_pool_info_tap_withdraw = 'earn_pool_info_tap_withdraw',
earn_pool_info_tap_deposit = 'earn_pool_info_tap_deposit',
earn_select_withdraw_type = 'earn_select_withdraw_type',
}
1 change: 1 addition & 0 deletions src/analytics/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,7 @@ interface EarnEventsProperties {
hasTokensOnSameNetwork: boolean
hasTokensOnOtherNetworks: boolean
}
[EarnEvents.earn_select_withdraw_type]: { type: 'partialWithdraw' | 'claim' | 'exit' }
MuckT marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: keep all the pool_info_tap ones together

}

export type AnalyticsPropertiesList = AppEventsProperties &
Expand Down
1 change: 1 addition & 0 deletions src/analytics/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ export const eventDocs: Record<AnalyticsEventType, string> = {
[EarnEvents.earn_pool_info_tap_info_icon]: `When the user taps an info icon on the earn pool info screen`,
[EarnEvents.earn_pool_info_tap_withdraw]: `When the user taps the withdraw button on the pool info screen`,
[EarnEvents.earn_pool_info_tap_deposit]: `When the user taps the deposit button on the pool info screen`,
[EarnEvents.earn_select_withdraw_type]: `When a use selects a withdraw type on the withdraw bottom sheet`,
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

finnian0826 marked this conversation as resolved.
Show resolved Hide resolved

// Legacy event docs
// The below events had docs, but are no longer produced by the latest app version.
Expand Down
6 changes: 3 additions & 3 deletions src/earn/BeforeDepositBottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { EarnEvents } from 'src/analytics/Events'
import { EarnCommonProperties, TokenProperties } from 'src/analytics/Properties'
import BottomSheet, { BottomSheetModalRefType } from 'src/components/BottomSheet'
import Touchable from 'src/components/Touchable'
import { BeforeDepositAction, BeforeDepositActionName } from 'src/earn/types'
import { BeforeDepositAction, BeforeDepositActionName, WithdrawAction } from 'src/earn/types'
import { ExternalExchangeProvider } from 'src/fiatExchanges/ExternalExchanges'
import { CICOFlow } from 'src/fiatExchanges/utils'
import QuickActionsAdd from 'src/icons/quick-actions/Add'
Expand All @@ -25,14 +25,14 @@ import { Spacing } from 'src/styles/styles'
import { TokenBalance } from 'src/tokens/slice'
import { getTokenAnalyticsProps } from 'src/tokens/utils'

function ActionCard({ action }: { action: BeforeDepositAction }) {
export function ActionCard({ action }: { action: BeforeDepositAction | WithdrawAction }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth moving this into its own file. Maybe even share with other parts of the app (token details, etc), seems like it's something we use throughout the app and would be nice to change styles in a single place for mobile stack apps

return (
<Touchable
style={styles.touchable}
key={action.name}
borderRadius={20}
onPress={action.onPress}
testID={`Earn/BeforeDepositBottomSheet/${action.name}`}
testID={`Earn/ActionCard/${action.name}`}
>
<>
<action.iconComponent color={Colors.black} />
Expand Down
Loading
Loading