diff --git a/src/assets/scss/components/_modal.scss b/src/assets/scss/components/_modal.scss index 671ff886..7cb27a60 100644 --- a/src/assets/scss/components/_modal.scss +++ b/src/assets/scss/components/_modal.scss @@ -377,6 +377,15 @@ .value { font-weight: 600; } + + .price.secondary { + .price-label span { + font-size: 14px; + } + .price-value { + font-size: 12px; + } + } } } .old-value { @@ -401,13 +410,13 @@ padding: 6px 10px; .field-left { - font-size: 15px; + font-size: 16px; font-weight: 600; color: $text-color-primary; } .field-right { - font-size: 15px; + font-size: 16px; .value { font-weight: 700; } diff --git a/src/components/Actions/Borrow.component.tsx b/src/components/Actions/Borrow.component.tsx index 083ba390..21a41bf5 100644 --- a/src/components/Actions/Borrow.component.tsx +++ b/src/components/Actions/Borrow.component.tsx @@ -252,7 +252,7 @@ export const BorrowModal: FC = ({ = ({ = ({ validationError } = useProtocolAction(poolId, chain, eProtocolAction.DEPOSIT) - console.log({ selectedTokenInfo }) - const healthFactor = useHealthFactor( poolId, eProtocolAction.DEPOSIT, @@ -276,7 +273,7 @@ export const SupplyModal: FC = ({ = ({ = ({ isOpen, onClose, data }) => {
- + {tokenConfig.symbol}
diff --git a/src/components/EnableToken/EnableToken.component.tsx b/src/components/EnableToken/EnableToken.component.tsx index 381a94aa..cdff5be4 100644 --- a/src/components/EnableToken/EnableToken.component.tsx +++ b/src/components/EnableToken/EnableToken.component.tsx @@ -2,7 +2,7 @@ import { type FC, useMemo, useCallback, useState } from 'react' import { Button, Modal, Icon } from '@/components' import type { tPoolIds, tSupportedChains, tSupportedTokens } from '@cedro-finance/sdk' -import { TokenIconMapping } from '@/constants' +import { getPoolIcon } from '@/constants' import { toast } from 'react-toastify' import { cedroClient } from '@/configs/chainConfig' @@ -50,7 +50,7 @@ export const EnableToken: FC = ({ poolId, onApprove, selectedC
- +
To Supply {token} to Cedro Protocol as diff --git a/src/components/LiquidityTooltip/LiquidityTooltip.component.tsx b/src/components/LiquidityTooltip/LiquidityTooltip.component.tsx index c560d86c..b8c18d00 100644 --- a/src/components/LiquidityTooltip/LiquidityTooltip.component.tsx +++ b/src/components/LiquidityTooltip/LiquidityTooltip.component.tsx @@ -2,7 +2,7 @@ import type { tSupportedChains } from '@cedro-finance/sdk' import { type FC } from 'react' import { Tooltip } from 'react-tooltip' import { Icon } from '../icon' -import { ChainIconMapping, getChainConfig } from '@/constants' +import { getChainConfig, getChainIcon } from '@/constants' import { NETWORK_TYPE } from '@/configs/env' interface ILiquidityTooltipProps { @@ -35,7 +35,7 @@ export const LiquidityTooltip: FC = ({ id }) => {
diff --git a/src/components/Navbar/AvailableTokens.component.tsx b/src/components/Navbar/AvailableTokens.component.tsx index e70e5587..717d7522 100644 --- a/src/components/Navbar/AvailableTokens.component.tsx +++ b/src/components/Navbar/AvailableTokens.component.tsx @@ -1,4 +1,4 @@ -import { TokenIconMapping } from '@/constants' +import { getPoolIcon } from '@/constants' import { truncateString, toFixedCutZero, toFixedNumber } from '@/utils' import { getIconName } from '@/utils/misc' import { Dropdown } from '../Dropdown' @@ -22,7 +22,7 @@ export const AvailableTokens: FC = () => { @@ -39,7 +39,7 @@ export const AvailableTokens: FC = () => {
- +
{tokenSymbol}
diff --git a/src/components/Navbar/NavbarSharedCompoent.tsx b/src/components/Navbar/NavbarSharedCompoent.tsx index 2d4a0d2c..067c9840 100644 --- a/src/components/Navbar/NavbarSharedCompoent.tsx +++ b/src/components/Navbar/NavbarSharedCompoent.tsx @@ -4,7 +4,7 @@ import { toFixedCutZero } from '@/utils' import { useAvailableBalance } from '@/hooks/useAvailableBalance' import { Dropdown } from '@/components/Dropdown' import { Icon, type TIcons } from '@/components/icon' -import { ChainIconMapping, TokenIconMapping } from '@/constants' +import { getChainIcon } from '@/constants' import { WalletConnect } from '@/components/wallet' import { Button } from '../Button' import { useChainContext } from '@/context/chain.context' @@ -31,9 +31,7 @@ export const SwitchNetworkDropdown: FC = () => { const iconName = useMemo(() => { return ( - ChainIconMapping[(connectedChain as ConnectedChain)?.chain ?? 'eth'] || - TokenIconMapping.unknown - ) + getChainIcon((connectedChain as ConnectedChain)?.chain ?? 'eth')) }, [connectedChain?.id]) return ( @@ -59,7 +57,7 @@ export const SwitchNetworkDropdown: FC = () => { }} > diff --git a/src/components/Price/Price.component.tsx b/src/components/Price/Price.component.tsx index 5e2e9efb..3cccd06b 100644 --- a/src/components/Price/Price.component.tsx +++ b/src/components/Price/Price.component.tsx @@ -36,9 +36,10 @@ export interface IValueWithPriceProps { displayUnit?: boolean variant?: 'primary' | 'secondary' unit?: string + prefix?: string } -export const ValueWithPrice: FC = ({ pool, value, displayUnit = false, unit, variant = 'primary' }) => { +export const ValueWithPrice: FC = ({ pool, value, displayUnit = false, unit, variant = 'primary', prefix = '' }) => { const { oraclePrices } = useAppSelector(state => state.pool) const poolPrice = useMemo(() => { @@ -58,7 +59,7 @@ export const ValueWithPrice: FC = ({ pool, value, displayU
{/* TODO should the precision be 4 for tokens? */}
- {toFixedNumber(value, 4, true)}{' '} + {prefix} {toFixedNumber(value, 4, true)} {displayUnit ? unit ?? getTokenSymbol(pool) : ''}
${toFixedCutZero(dollarEquivalent, 2, true)}
diff --git a/src/components/modal/LiquidationList.component.tsx b/src/components/modal/LiquidationList.component.tsx index 9a67b4fe..78fd3035 100644 --- a/src/components/modal/LiquidationList.component.tsx +++ b/src/components/modal/LiquidationList.component.tsx @@ -5,7 +5,7 @@ import { type ColumnDef } from '@tanstack/react-table' import { type Address, type ILiquidationData } from '@cedro-finance/sdk' import { cedroClient } from '@/configs/chainConfig' import { useAccount } from 'wagmi' -import { DEFAULT_WEI_DECIMAL, TokenIconMapping, ZERO_ADDRESS } from '@/constants' +import { DEFAULT_WEI_DECIMAL, getPoolIcon, ZERO_ADDRESS } from '@/constants' import { convertBigIntValueToNormal } from '@/utils' interface LiquidationListProps { @@ -44,7 +44,7 @@ const liquidationListColumnDefinition: Array> = [ header: 'Asset', cell: (props) => { const pool = (props.row.original as ILiquidationData).collateralId - return + return }, meta: { getCellContext () { @@ -84,7 +84,7 @@ const liquidationListColumnDefinition: Array> = [ header: 'Asset', cell: (props) => { const pool = (props.row.original as ILiquidationData).debtId - return + return }, meta: { getCellContext: () => { diff --git a/src/components/modal/SwitchNetwork.component.tsx b/src/components/modal/SwitchNetwork.component.tsx index 8fd4f7d9..0a4105c3 100644 --- a/src/components/modal/SwitchNetwork.component.tsx +++ b/src/components/modal/SwitchNetwork.component.tsx @@ -3,7 +3,7 @@ import { type FC } from 'react' import { Button, Modal, Icon } from '@/components' import { type IChainConfig } from '@/@types' import { useNetwork } from 'wagmi' -import { NETWORK_SWITCH_TYPE, NetworkIconMapping } from '@/constants' +import { getNetworkIcon, NETWORK_SWITCH_TYPE } from '@/constants' interface SwitchNetworkProps { isVisible: boolean @@ -70,7 +70,7 @@ export const SwitchNetwork: FC = ({ switchType, isVisible, t
{switchType !== NETWORK_SWITCH_TYPE.UNSUPPORTED ? <>
- +
{currentNetwork?.name}
@@ -82,7 +82,7 @@ export const SwitchNetwork: FC = ({ switchType, isVisible, t : null}
- +
{switchToNetwork?.name}
diff --git a/src/components/modal/TestTokens.component.tsx b/src/components/modal/TestTokens.component.tsx index e679c8f0..a8e94515 100644 --- a/src/components/modal/TestTokens.component.tsx +++ b/src/components/modal/TestTokens.component.tsx @@ -9,12 +9,13 @@ import { useChainContext } from '@/context/chain.context' import { useAccount } from 'wagmi' import { erc20MockAbi } from '@/abis' import { Faucet, getTokenSymbol } from '@/constants' -import { TokenIconMapping } from '@/constants/icons' +import { getPoolIcon } from '@/constants/icons' import { type IChainConfig } from '@/@types' import { Tooltip } from 'react-tooltip' import { truncateString } from '@/utils' import { toast } from 'react-toastify' import { cedroClient } from '@/configs/chainConfig' +import { type tPoolIds } from '@cedro-finance/sdk' interface IToken { symbol: string @@ -111,7 +112,7 @@ export const TestTokens: FC = ({
{/* // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */} diff --git a/src/components/shared/ChainlistCheckbox/ChainlistCheckbox.component.tsx b/src/components/shared/ChainlistCheckbox/ChainlistCheckbox.component.tsx index b3c7b9db..32c40762 100644 --- a/src/components/shared/ChainlistCheckbox/ChainlistCheckbox.component.tsx +++ b/src/components/shared/ChainlistCheckbox/ChainlistCheckbox.component.tsx @@ -3,7 +3,7 @@ import { Dropdown } from '@/components/Dropdown' import { Icon } from '@/components/icon' import { Button } from '@/components/Button' import { type tSupportedChains } from '@cedro-finance/sdk' -import { ChainIconMapping } from '@/constants' +import { getChainIcon } from '@/constants' import { cedroClient } from '@/configs/chainConfig' interface IChainlistCheckboxProps { @@ -85,7 +85,7 @@ export const ChainListCheckbox: FC = ({ checkedChainLis readOnly id={chainInfo.symbol} /> - + {chainInfo.name} diff --git a/src/components/shared/actions/ActionAccordion.component.tsx b/src/components/shared/actions/ActionAccordion.component.tsx index 24577aac..faf27498 100644 --- a/src/components/shared/actions/ActionAccordion.component.tsx +++ b/src/components/shared/actions/ActionAccordion.component.tsx @@ -1,9 +1,13 @@ import React, { type FC } from 'react' import { Accordion } from './Accordion.component' +import { ValueWithPrice } from '@/components/Price' +import { type tPoolIds } from '@cedro-finance/sdk' +import { AboutTooltip } from '@/components/AboutTooltip' +import { TooltipText } from '@/constants' interface ActionAccordionProps { fieldName: string - token: string + pool: tPoolIds values: { gasOnDestination: string fee: string @@ -13,7 +17,7 @@ interface ActionAccordionProps { } children: React.ReactNode } -export const ActionAccordion: FC = ({ fieldName, token, children, values }) => { +export const ActionAccordion: FC = ({ fieldName, pool, children, values }) => { // const [airdropAmount, setAirdropAmount] = useState() // const handleAirdropAmountChange = (e: ChangeEvent): void => { // setAirdropAmount(Number(e.target.value)) @@ -30,9 +34,19 @@ export const ActionAccordion: FC = ({ fieldName, token, ch const accordionContent = ( <>
-
Rebalancing Reward
+
+ Rebalancing Reward + +
- + {values.reward} {token} + {/* TODO add loading to value with price */} +
{/*
@@ -53,25 +67,52 @@ export const ActionAccordion: FC = ({ fieldName, token, ch
*/}
-
Rebalancing Fee
+
+ Rebalancing Fee + +
- - {values.fee} {token} +
{values.gasFee && (
-
Transaction Fee
+
+ Gas Fee + +
- - {values.gasFee} {token} +
)} {values.layerzero && (
-
LayerZero Fee
+
+ LayerZero Fee + +
- - {values.layerzero} {token} +
)} diff --git a/src/components/shared/actions/AmountInput.component.tsx b/src/components/shared/actions/AmountInput.component.tsx index b1efa31c..72fa4e7b 100644 --- a/src/components/shared/actions/AmountInput.component.tsx +++ b/src/components/shared/actions/AmountInput.component.tsx @@ -69,8 +69,6 @@ export const AmountInput: FC = ({ inputType, switchInputType, newNativeBalance = bigIntMin(newNativeBalance, maxNativeAmount) newDollarBalance = bigIntMin(newDollarBalance, maxDollarAmount) - console.log({ newNativeBalance, newDollarBalance }) - setInputValues(prev => ({ ...prev, native: formatUnits(newNativeBalance, 18), usdc: formatUnits(newDollarBalance, 18) })) } diff --git a/src/components/shared/actions/DestinationChain.component.tsx b/src/components/shared/actions/DestinationChain.component.tsx index d4454e41..e8c47eb6 100644 --- a/src/components/shared/actions/DestinationChain.component.tsx +++ b/src/components/shared/actions/DestinationChain.component.tsx @@ -6,7 +6,7 @@ import { type tPoolIds, type tSupportedChains } from '@cedro-finance/sdk' -import { ChainIconMapping, DEFAULT_WEI_DECIMAL } from '@/constants' +import { DEFAULT_WEI_DECIMAL, getChainIcon } from '@/constants' import { usePoolDetails } from '@/hooks/usePoolDetails' import { convertBigIntValueToNormal, weiMultiply } from '@/utils' import { cedroClient } from '@/configs/chainConfig' @@ -49,7 +49,7 @@ export const DestinationChain: FC = ({