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

fix: harbor clear withdraw tiers #912

Merged
merged 1 commit into from
Dec 19, 2024
Merged
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
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
Loading