Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmagnus committed Dec 6, 2023
1 parent c3a451b commit f6f5976
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 50 deletions.
3 changes: 3 additions & 0 deletions frontend/src/app/core/pages/contracts-detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
Expand Down Expand Up @@ -94,6 +95,7 @@ export const ContractsDetail: React.FC = () => {

setLoadingPosition(false)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
contract,
contractData?.position,
Expand All @@ -116,6 +118,7 @@ export const ContractsDetail: React.FC = () => {
return () => {
clearInterval(interval)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [profile, contract])

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/molecules/select-vault/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const DepositDetails: React.FC<IDepositDetails> = ({
}

return (
<Flex flexDir={{ base: 'row', md: 'row' }} w="full">
<Flex flexDir="column" w="full">
<Text fontSize="sm" mb="0.5rem" ms="0.25rem">
Deposit info
</Text>
Expand Down Expand Up @@ -132,26 +132,28 @@ export const DepositDetails: React.FC<IDepositDetails> = ({
</Text>
</Flex>

<Flex flexDir="column" w="full">
<Text
bg="gray.100"
borderRadius="full"
fontWeight="bold"
fontSize="xs"
px="0.75rem"
py="0.25rem"
w="fit-content"
mb="0.15rem"
>
Next yield in
</Text>
<Flex ms="0.5rem">
<Countdown
date={Date.now() + calculateNextYield() * 1000}
renderer={renderer}
/>
{contract.compound > 0 && (
<Flex flexDir="column" w="full">
<Text
bg="gray.100"
borderRadius="full"
fontWeight="bold"
fontSize="xs"
px="0.75rem"
py="0.25rem"
w="fit-content"
mb="0.15rem"
>
Composed in
</Text>
<Flex ms="0.5rem">
<Countdown
date={Date.now() + calculateNextYield() * 1000}
renderer={renderer}
/>
</Flex>
</Flex>
</Flex>
)}
</Flex>

<ContractHistory contract={contract} history={history} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const Deposit: React.FC<IDeposit> = ({
currentBalance,
}) => {
const {
register,
formState: { errors },
handleSubmit,
setValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -14,13 +14,6 @@ export const WithdrawDetails: React.FC<IWithdrawDetails> = ({
contractData,
history,
}) => {
interface ICountdown {
days: number
hours: number
minutes: number
seconds: number
completed: boolean
}

return (
<Flex flexDir="column" w="full">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Alert,
Box,
Button,
Checkbox,
Expand All @@ -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 {
Expand Down Expand Up @@ -49,8 +47,9 @@ export const Withdraw: React.FC<IWithdraw> = ({
}

const insuficientBalance = (): boolean => {
console.log(currentInVault)
console.log(Number(toNumber(currentInVault)))
if (!isDone) {
return contractData.estimatedPrematureWithdraw > Number(currentInVault)
}
return contractData.position > Number(currentInVault)
}

Expand Down
10 changes: 7 additions & 3 deletions frontend/src/components/templates/contracts-detail/index.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -43,7 +43,7 @@ export const ContractsDetailTemplate: React.FC<IContractsDetailTemplate> = ({
history,
deposited,
userPermissions,
currentInVault
currentInVault,
}) => {
return (
<Flex flexDir="column" w="full">
Expand All @@ -55,7 +55,11 @@ export const ContractsDetailTemplate: React.FC<IContractsDetailTemplate> = ({
<Flex justifyContent="space-between">
<ContractsBreadcrumb title="Certificate Name" />
</Flex>
<Flex w="full" justifyContent="space-between" flexDir={{ base: 'column-reverse', md: 'row' }}>
<Flex
w="full"
justifyContent="space-between"
flexDir={{ base: 'column-reverse', md: 'row' }}
>
<Container
variant="primary"
mr="1.5rem"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/templates/home/carousel-data.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Text, Box, Flex } from '@chakra-ui/react'
import { Text, Box } from '@chakra-ui/react'

import VIDEO_ASSET_MANAGEMENT from 'app/core/resources/home-videos/asset-management.mp4'
import VIDEO_DASHBOARDS from 'app/core/resources/home-videos/dashboards.mp4'
import VIDEO_GENERAL from 'app/core/resources/home-videos/general.mp4'
import VIDEO_ROLES from 'app/core/resources/home-videos/roles.mp4'
import VIDEO_SOROBAN from 'app/core/resources/home-videos/soroban.mp4'
import VIDEO_TREASURY from 'app/core/resources/home-videos/treasury.mp4'
Expand All @@ -13,6 +12,7 @@ export const carouselData = [
slide: "https://www.youtube.com/embed/F4eFUwpcEYA?si=WQJpVCXhfhR3qVa5",
actionName: undefined,
actionDestination: undefined,
isYoutube: true,
children: (
<Box>
<Text>
Expand Down
15 changes: 11 additions & 4 deletions frontend/src/components/templates/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,22 @@ export const HomeTemplate: React.FC<IHomeTemplate> = () => {
w="fit-content"
mb="2rem"
>
<Box w="full" h="full" top="-4px" pos="relative">
<Box
w={data.isYoutube ? '740px' : 'full'}
h={data.isYoutube ? '420px' : 'full'}
top="-4px"
pos="relative"
>
<ReactPlayer
playing
playing={data.isYoutube ? false : true}
loop
muted
muted={data.isYoutube ? false : true}
url={data.slide}
width="100%"
height="100%"
config={{ youtube: { embedOptions: {width: '100%'} } }}
config={{
youtube: { embedOptions: { width: '100%' } },
}}
/>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useAuth/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const AuthProvider: React.FC<IProps> = ({ children }) => {
} finally {
setLoading(false)
}
}, [])
}, [getAccountData])

const getUserPermissions = useCallback(async (): Promise<
Hooks.UseAuthTypes.IUserPermission[] | undefined
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/hooks/useContracts/context.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -96,7 +95,7 @@ export const ContractsProvider: React.FC<IProps> = ({ children }) => {
setLoading(false)
}
},
[]
[getAccountData]
)

const deposit = async (
Expand Down Expand Up @@ -218,7 +217,6 @@ export const ContractsProvider: React.FC<IProps> = ({ children }) => {
setWithdrawConfirmed(true)
return result.status === 'SUCCESS'
} catch (error) {
console.log(error)
if (axios.isAxiosError(error)) {
throw new Error(error.message)
}
Expand Down

0 comments on commit f6f5976

Please sign in to comment.