From d95f947065c5777f25d6c3ed952c8ae6a3808b16 Mon Sep 17 00:00:00 2001 From: EvgeniyJB Date: Thu, 19 Dec 2024 12:02:47 +0100 Subject: [PATCH] fix: harbor clear withdraw tiers --- src/entities/harbor/model/harbor-store.ts | 4 ++++ src/entities/harbor/model/types.ts | 1 + .../firebaseEventAnalytics/sendFirebaseEvent.ts | 2 +- src/localization/locales/English.json | 4 ++-- .../WithdrawHarborScreen/WithdrawHarborScreen.tsx | 15 ++++++++++++--- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/entities/harbor/model/harbor-store.ts b/src/entities/harbor/model/harbor-store.ts index 342cb47b3..88e51c4e2 100644 --- a/src/entities/harbor/model/harbor-store.ts +++ b/src/entities/harbor/model/harbor-store.ts @@ -26,6 +26,10 @@ export const useHarborStore = create((set) => ({ setActiveAmbTier: (activeAmbTier: TierRewardItem) => set({ activeAmbTier }), setActiveBondTier: (activeBondTier: TierRewardItem) => set({ activeBondTier }), + setDefaultActiveAmbTiers: () => { + set({ activeAmbTier: REWARD_TIERS_LIST.amb[0] }); + set({ activeBondTier: REWARD_TIERS_LIST.bond[2] }); + }, updateWithdrawList: async (address: string) => { try { set({ withdrawListLoader: true }); diff --git a/src/entities/harbor/model/types.ts b/src/entities/harbor/model/types.ts index 3919f3903..a24f59fd6 100644 --- a/src/entities/harbor/model/types.ts +++ b/src/entities/harbor/model/types.ts @@ -43,6 +43,7 @@ export interface HarborStoreModel { activeAmbTier: TierRewardItem; setActiveAmbTier: (payload: TierRewardItem) => void; activeBondTier: TierRewardItem; + setDefaultActiveAmbTiers: () => void; claimAmount: BigNumber; updateWithdrawList: (payload: string) => void; clearWithdrawList: () => void; diff --git a/src/lib/firebaseEventAnalytics/sendFirebaseEvent.ts b/src/lib/firebaseEventAnalytics/sendFirebaseEvent.ts index 7175d033f..22eb3c5a0 100644 --- a/src/lib/firebaseEventAnalytics/sendFirebaseEvent.ts +++ b/src/lib/firebaseEventAnalytics/sendFirebaseEvent.ts @@ -2,7 +2,7 @@ import { CustomAppEvents } from '@lib/firebaseEventAnalytics/constants/CustomApp import analytics from '@react-native-firebase/analytics'; export const sendFirebaseEvent = (event: CustomAppEvents, params?: object) => { - // if (!event || __DEV__) return; + if (!event || __DEV__) return; const paramsNotEmpty = params && Object.keys(params); alert(`send event: ${event}`); try { diff --git a/src/localization/locales/English.json b/src/localization/locales/English.json index 05eb360ca..b4c91787e 100644 --- a/src/localization/locales/English.json +++ b/src/localization/locales/English.json @@ -158,8 +158,8 @@ "common.status.success": "Success", "common.tx.confirmed": "Transaction confirmed.", "common.details": "Details", - "common.day": "day", - "common.days": "days", + "common.day": "gün", + "common.days": "günler", "create.wallet.backup": "Backup your wallet", "create.wallet.backup.header": "Backup wallet", diff --git a/src/screens/Harbor/WithdrawHarborScreen/WithdrawHarborScreen.tsx b/src/screens/Harbor/WithdrawHarborScreen/WithdrawHarborScreen.tsx index 523316723..3c4a55b2c 100644 --- a/src/screens/Harbor/WithdrawHarborScreen/WithdrawHarborScreen.tsx +++ b/src/screens/Harbor/WithdrawHarborScreen/WithdrawHarborScreen.tsx @@ -1,11 +1,11 @@ -import React, { useEffect, useRef } from 'react'; +import React, { useCallback, useEffect, useRef } from 'react'; import { RefreshControl, ScrollView, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useTranslation } from 'react-i18next'; import { Header } from '@components/composite'; import { Button } from '@components/base'; import { NoteIcon } from '@components/svg/icons/v2/harbor'; -import { useNavigation } from '@react-navigation/native'; +import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { HarborNavigationProp } from '@appTypes/navigation/harbor'; import { useEffectOnce, useKeyboardHeight } from '@hooks'; import { useHarborStore } from '@entities/harbor/model/harbor-store'; @@ -21,11 +21,20 @@ export const WithdrawHarborScreen = () => { const scrollRef = useRef(null); const navigation = useNavigation(); - const { getClaimAmount, updateAll, loading } = useHarborStore(); + const { getClaimAmount, updateAll, loading, setDefaultActiveAmbTiers } = + useHarborStore(); const { wallet } = useWalletStore(); useEffectOnce(() => { getClaimAmount(wallet?.address || ''); }); + + useFocusEffect( + useCallback(() => { + return () => { + setDefaultActiveAmbTiers(); + }; + }, [setDefaultActiveAmbTiers]) + ); const RightContent = () => (