+
+ );
+}
diff --git a/apps/veyfi/components/TabManageVeYFI.tsx b/apps/veyfi/components/TabManageVeYFI.tsx
new file mode 100644
index 000000000..47cb4a64c
--- /dev/null
+++ b/apps/veyfi/components/TabManageVeYFI.tsx
@@ -0,0 +1,33 @@
+import {useVotingEscrow} from '@veYFI/contexts/useVotingEscrow';
+import {toBigInt, toNormalizedBN} from '@yearn-finance/web-lib/utils/format.bigNumber';
+import {getTimeUntil, toWeeks} from '@yearn-finance/web-lib/utils/time';
+
+import {ClaimVeYFI} from './ViewClaimVeYFI';
+import {EarlyExitVeYFI} from './ViewEarlyExitVeYFI';
+import {ExtendLockVeYFI} from './ViewExtendLockVeYFI';
+import {LockVeYFI} from './ViewLockVeYFI';
+
+import type {ReactElement} from 'react';
+
+export function TabManageVeYFI(): ReactElement {
+ const {positions} = useVotingEscrow();
+ const hasLock = toNormalizedBN(toBigInt(positions?.deposit?.underlyingBalance), 18);
+ const timeUntilUnlock = positions?.unlockTime ? getTimeUntil(positions?.unlockTime) : undefined;
+ const weeksToUnlock = toWeeks(timeUntilUnlock);
+
+ return (
+
+
+ {(hasLock && weeksToUnlock > 0) ? (
+ <>
+
+
+
+
+
+
+ >
+ ) : null}
+
+ );
+}
diff --git a/apps/veyfi/components/ClaimTab.tsx b/apps/veyfi/components/ViewClaimVeYFI.tsx
similarity index 98%
rename from apps/veyfi/components/ClaimTab.tsx
rename to apps/veyfi/components/ViewClaimVeYFI.tsx
index f5efd3902..3a21755d2 100644
--- a/apps/veyfi/components/ClaimTab.tsx
+++ b/apps/veyfi/components/ViewClaimVeYFI.tsx
@@ -12,7 +12,7 @@ import {useWallet} from '@common/contexts/useWallet';
import type {ReactElement} from 'react';
-export function ClaimTab(): ReactElement {
+export function ClaimVeYFI(): ReactElement {
const {provider, address, isActive} = useWeb3();
const {refresh: refreshBalances} = useWallet();
const {votingEscrow, positions, refresh: refreshVotingEscrow} = useVotingEscrow();
diff --git a/apps/veyfi/components/ViewEarlyExitVeYFI.tsx b/apps/veyfi/components/ViewEarlyExitVeYFI.tsx
new file mode 100644
index 000000000..43ecfb8cc
--- /dev/null
+++ b/apps/veyfi/components/ViewEarlyExitVeYFI.tsx
@@ -0,0 +1,79 @@
+import {useCallback, useState} from 'react';
+import {useVotingEscrow} from '@veYFI/contexts/useVotingEscrow';
+import {withdrawLockedVeYFI} from '@veYFI/utils/actions';
+import {VEYFI_CHAIN_ID} from '@veYFI/utils/constants';
+import {Button} from '@yearn-finance/web-lib/components/Button';
+import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3';
+import {toBigInt, toNormalizedBN} from '@yearn-finance/web-lib/utils/format.bigNumber';
+import {getTimeUntil, toWeeks} from '@yearn-finance/web-lib/utils/time';
+import {defaultTxStatus} from '@yearn-finance/web-lib/utils/web3/transaction';
+import {AmountInput} from '@common/components/AmountInput';
+import {useWallet} from '@common/contexts/useWallet';
+
+import type {ReactElement} from 'react';
+
+export function EarlyExitVeYFI(): ReactElement {
+ const {provider, address, isActive} = useWeb3();
+ const {refresh: refreshBalances} = useWallet();
+ const {votingEscrow, positions, refresh: refreshVotingEscrow} = useVotingEscrow();
+ const timeUntilUnlock = positions?.unlockTime ? getTimeUntil(positions?.unlockTime) : undefined;
+ const weeksToUnlock = toNormalizedBN(toWeeks(timeUntilUnlock), 0);
+ const hasPenalty = toBigInt(positions?.penalty) > 0n;
+ const [withdrawLockedStatus, set_withdrawLockedStatus] = useState(defaultTxStatus);
+
+ const onTxSuccess = useCallback(async (): Promise
=> {
+ await Promise.all([refreshVotingEscrow(), refreshBalances()]);
+ }, [refreshBalances, refreshVotingEscrow]);
+
+ const onWithdrawLocked = useCallback(async (): Promise => {
+ const result = await withdrawLockedVeYFI({
+ connector: provider,
+ chainID: VEYFI_CHAIN_ID,
+ contractAddress: votingEscrow?.address,
+ statusHandler: set_withdrawLockedStatus
+ });
+ if (result.isSuccessful) {
+ onTxSuccess();
+ }
+ }, [onTxSuccess, provider, votingEscrow?.address]);
+
+ return (
+
+
+
+ {'Early exit'}
+
+
+
{'Or you can exit early by paying a penalty based on lock duration.'}
+
+
+
+
+
+ );
+}
diff --git a/apps/veyfi/components/ManageLockTab.tsx b/apps/veyfi/components/ViewExtendLockVeYFI.tsx
similarity index 59%
rename from apps/veyfi/components/ManageLockTab.tsx
rename to apps/veyfi/components/ViewExtendLockVeYFI.tsx
index 3dac07a4f..043d4223a 100644
--- a/apps/veyfi/components/ManageLockTab.tsx
+++ b/apps/veyfi/components/ViewExtendLockVeYFI.tsx
@@ -1,7 +1,7 @@
import {useCallback, useMemo, useState} from 'react';
import {useVotingEscrow} from '@veYFI/contexts/useVotingEscrow';
import {getVotingPower} from '@veYFI/utils';
-import {extendVeYFILockTime, withdrawLockedVeYFI} from '@veYFI/utils/actions';
+import {extendVeYFILockTime} from '@veYFI/utils/actions';
import {MAX_LOCK_TIME, MIN_LOCK_TIME, VEYFI_CHAIN_ID} from '@veYFI/utils/constants';
import {validateAmount} from '@veYFI/utils/validations';
import {Button} from '@yearn-finance/web-lib/components/Button';
@@ -13,14 +13,10 @@ import {defaultTxStatus} from '@yearn-finance/web-lib/utils/web3/transaction';
import {AmountInput} from '@common/components/AmountInput';
import {useWallet} from '@common/contexts/useWallet';
-import {ClaimTab} from './ClaimTab';
-import {LockTab} from './LockTab';
-
import type {ReactElement} from 'react';
import type {TNormalizedBN} from '@common/types/types';
-
-function ExtendLock(): ReactElement {
+export function ExtendLockVeYFI(): ReactElement {
const [lockTime, set_lockTime] = useState(toNormalizedBN(0, 0));
const {provider, address, isActive} = useWeb3();
const {refresh: refreshBalances} = useWallet();
@@ -113,92 +109,3 @@ function ExtendLock(): ReactElement {
);
}
-
-function EarlyExit(): ReactElement {
- const {provider, address, isActive} = useWeb3();
- const {refresh: refreshBalances} = useWallet();
- const {votingEscrow, positions, refresh: refreshVotingEscrow} = useVotingEscrow();
- const timeUntilUnlock = positions?.unlockTime ? getTimeUntil(positions?.unlockTime) : undefined;
- const weeksToUnlock = toNormalizedBN(toWeeks(timeUntilUnlock), 0);
- const hasPenalty = toBigInt(positions?.penalty) > 0n;
- const [withdrawLockedStatus, set_withdrawLockedStatus] = useState(defaultTxStatus);
-
- const onTxSuccess = useCallback(async (): Promise