diff --git a/frontend/src/app/core/pages/contracts-detail/index.tsx b/frontend/src/app/core/pages/contracts-detail/index.tsx index 707e0f43..c82f6aa5 100644 --- a/frontend/src/app/core/pages/contracts-detail/index.tsx +++ b/frontend/src/app/core/pages/contracts-detail/index.tsx @@ -51,6 +51,7 @@ export const ContractsDetail: React.FC = () => { setContract(contract) }) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [getProfile]) const loadContractData = useCallback(async (): Promise => { @@ -94,6 +95,7 @@ export const ContractsDetail: React.FC = () => { setLoadingPosition(false) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ contract, contractData?.position, @@ -116,6 +118,7 @@ export const ContractsDetail: React.FC = () => { return () => { clearInterval(interval) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [profile, contract]) useEffect(() => { diff --git a/frontend/src/components/molecules/select-vault/index.tsx b/frontend/src/components/molecules/select-vault/index.tsx index 41b49b1a..1008b84e 100644 --- a/frontend/src/components/molecules/select-vault/index.tsx +++ b/frontend/src/components/molecules/select-vault/index.tsx @@ -9,7 +9,7 @@ import React, { import { User } from 'react-feather' import Select from 'react-select' -import { VaultIcon, WalletIcon } from 'components/icons' +import { VaultIcon } from 'components/icons' export interface IOption { readonly label: string diff --git a/frontend/src/components/templates/contracts-detail/components/contract-history/index.tsx b/frontend/src/components/templates/contracts-detail/components/contract-history/index.tsx index 06e6ea6c..6145c737 100644 --- a/frontend/src/components/templates/contracts-detail/components/contract-history/index.tsx +++ b/frontend/src/components/templates/contracts-detail/components/contract-history/index.tsx @@ -1,7 +1,6 @@ import { Flex, Table, Tbody, Td, Text, Th, Thead, Tr } from '@chakra-ui/react' -import React, { useEffect, useState } from 'react' +import React from 'react' -import { useContracts } from 'hooks/useContracts' import { formatDateFullClean, toCrypto } from 'utils/formatter' interface IWithdrawDetails { diff --git a/frontend/src/components/templates/contracts-detail/components/deposit-details/index.tsx b/frontend/src/components/templates/contracts-detail/components/deposit-details/index.tsx index c7b7d93a..0d7bb4e2 100644 --- a/frontend/src/components/templates/contracts-detail/components/deposit-details/index.tsx +++ b/frontend/src/components/templates/contracts-detail/components/deposit-details/index.tsx @@ -58,7 +58,7 @@ export const DepositDetails: React.FC = ({ } return ( - + Deposit info @@ -132,26 +132,28 @@ export const DepositDetails: React.FC = ({ - - - Next yield in - - - + {contract.compound > 0 && ( + + + Composed in + + + + - + )} diff --git a/frontend/src/components/templates/contracts-detail/components/deposit/index.tsx b/frontend/src/components/templates/contracts-detail/components/deposit/index.tsx index 043a3e00..d9f35eaa 100644 --- a/frontend/src/components/templates/contracts-detail/components/deposit/index.tsx +++ b/frontend/src/components/templates/contracts-detail/components/deposit/index.tsx @@ -34,7 +34,6 @@ export const Deposit: React.FC = ({ currentBalance, }) => { const { - register, formState: { errors }, handleSubmit, setValue, diff --git a/frontend/src/components/templates/contracts-detail/components/withdraw-details/index.tsx b/frontend/src/components/templates/contracts-detail/components/withdraw-details/index.tsx index 4102818a..b48fcd13 100644 --- a/frontend/src/components/templates/contracts-detail/components/withdraw-details/index.tsx +++ b/frontend/src/components/templates/contracts-detail/components/withdraw-details/index.tsx @@ -1,5 +1,5 @@ import { Flex, Text } from '@chakra-ui/react' -import React, { ReactNode } from 'react' +import React from 'react' import { ContractHistory } from '../contract-history' @@ -14,13 +14,6 @@ export const WithdrawDetails: React.FC = ({ contractData, history, }) => { - interface ICountdown { - days: number - hours: number - minutes: number - seconds: number - completed: boolean - } return ( diff --git a/frontend/src/components/templates/contracts-detail/components/withdraw/index.tsx b/frontend/src/components/templates/contracts-detail/components/withdraw/index.tsx index e443a017..c344f2d2 100644 --- a/frontend/src/components/templates/contracts-detail/components/withdraw/index.tsx +++ b/frontend/src/components/templates/contracts-detail/components/withdraw/index.tsx @@ -1,5 +1,4 @@ import { - Alert, Box, Button, Checkbox, @@ -13,7 +12,6 @@ import React, { ReactNode, useState } from 'react' import Countdown from 'react-countdown' import { useForm } from 'react-hook-form' -import { toNumber } from 'lodash' import { toCrypto } from 'utils/formatter' interface IWithdraw { @@ -49,8 +47,9 @@ export const Withdraw: React.FC = ({ } const insuficientBalance = (): boolean => { - console.log(currentInVault) - console.log(Number(toNumber(currentInVault))) + if (!isDone) { + return contractData.estimatedPrematureWithdraw > Number(currentInVault) + } return contractData.position > Number(currentInVault) } diff --git a/frontend/src/components/templates/contracts-detail/index.tsx b/frontend/src/components/templates/contracts-detail/index.tsx index 2a803df6..36fe18b0 100644 --- a/frontend/src/components/templates/contracts-detail/index.tsx +++ b/frontend/src/components/templates/contracts-detail/index.tsx @@ -1,4 +1,4 @@ -import { Container, Flex, Skeleton, Text } from '@chakra-ui/react' +import { Container, Flex, Skeleton } from '@chakra-ui/react' import React from 'react' import { FieldValues, UseFormSetValue } from 'react-hook-form' @@ -43,7 +43,7 @@ export const ContractsDetailTemplate: React.FC = ({ history, deposited, userPermissions, - currentInVault + currentInVault, }) => { return ( @@ -55,7 +55,11 @@ export const ContractsDetailTemplate: React.FC = ({ - + diff --git a/frontend/src/components/templates/home/index.tsx b/frontend/src/components/templates/home/index.tsx index 90f27320..b042151f 100644 --- a/frontend/src/components/templates/home/index.tsx +++ b/frontend/src/components/templates/home/index.tsx @@ -88,15 +88,22 @@ export const HomeTemplate: React.FC = () => { w="fit-content" mb="2rem" > - + diff --git a/frontend/src/hooks/useAuth/context.tsx b/frontend/src/hooks/useAuth/context.tsx index 70aacf06..8cef3874 100644 --- a/frontend/src/hooks/useAuth/context.tsx +++ b/frontend/src/hooks/useAuth/context.tsx @@ -193,7 +193,7 @@ export const AuthProvider: React.FC = ({ children }) => { } finally { setLoading(false) } - }, []) + }, [getAccountData]) const getUserPermissions = useCallback(async (): Promise< Hooks.UseAuthTypes.IUserPermission[] | undefined diff --git a/frontend/src/hooks/useContracts/context.tsx b/frontend/src/hooks/useContracts/context.tsx index 2dc093b2..99df286b 100644 --- a/frontend/src/hooks/useContracts/context.tsx +++ b/frontend/src/hooks/useContracts/context.tsx @@ -1,5 +1,4 @@ -import { position } from '@chakra-ui/react' -import { SetStateAction, createContext, useCallback, useState } from 'react' +import { createContext, useCallback, useState } from 'react' import freighter from '@stellar/freighter-api' import axios from 'axios' @@ -96,7 +95,7 @@ export const ContractsProvider: React.FC = ({ children }) => { setLoading(false) } }, - [] + [getAccountData] ) const deposit = async ( @@ -218,7 +217,6 @@ export const ContractsProvider: React.FC = ({ children }) => { setWithdrawConfirmed(true) return result.status === 'SUCCESS' } catch (error) { - console.log(error) if (axios.isAxiosError(error)) { throw new Error(error.message) }