Skip to content

Commit

Permalink
Merge pull request #912 from ambrosus/harbor-hotfix
Browse files Browse the repository at this point in the history
fix: harbor clear withdraw tiers
  • Loading branch information
EvgeniyJB authored Dec 19, 2024
2 parents c9a3793 + d95f947 commit e402043
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/entities/harbor/model/harbor-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export const useHarborStore = create<HarborStoreModel>((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 });
Expand Down
1 change: 1 addition & 0 deletions src/entities/harbor/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/firebaseEventAnalytics/sendFirebaseEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/localization/locales/English.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 12 additions & 3 deletions src/screens/Harbor/WithdrawHarborScreen/WithdrawHarborScreen.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -21,11 +21,20 @@ export const WithdrawHarborScreen = () => {
const scrollRef = useRef<ScrollView>(null);

const navigation = useNavigation<HarborNavigationProp>();
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 = () => (
<Button onPress={() => navigation.navigate('WithdrawRequests')}>
<NoteIcon />
Expand Down

0 comments on commit e402043

Please sign in to comment.