From 920d3342bc2398c6033247473d8c857d7a5e314c Mon Sep 17 00:00:00 2001 From: iamoskvin <44796732+iamoskvin@users.noreply.github.com> Date: Sun, 18 Aug 2024 13:54:21 +0300 Subject: [PATCH] Iamoskvin/vault token logos (#395) * fix small logic error * added token logos to my deposits * added vault name --- src/components/FeeBadge/index.tsx | 4 ++-- src/pages/Vault/index.tsx | 34 ++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/components/FeeBadge/index.tsx b/src/components/FeeBadge/index.tsx index b07656f7..3260da2c 100644 --- a/src/components/FeeBadge/index.tsx +++ b/src/components/FeeBadge/index.tsx @@ -1,7 +1,7 @@ import React from 'react' import styled from 'styled-components' -const FeeBadgeContainer = styled.div` +export const FeeBadgeContainer = styled.div` display: inline-flex; padding: 4px 8px; border-radius: 4px; @@ -12,6 +12,6 @@ const FeeBadgeContainer = styled.div` line-height: 1; ` -const FeeBadge = ({ children}: {children: string}) => {children} +const FeeBadge = ({ children }: { children: string }) => {children} export default FeeBadge diff --git a/src/pages/Vault/index.tsx b/src/pages/Vault/index.tsx index 9b6af53c..126e24e0 100644 --- a/src/pages/Vault/index.tsx +++ b/src/pages/Vault/index.tsx @@ -53,6 +53,8 @@ import { useQuery } from 'react-query' import { TOKENS_DATA } from 'apollo/queries' import { getClient } from 'apollo/client' import { findClosestPrice } from 'utils/getClosest' +import CurrencyLogo from 'components/Logo/CurrencyLogo' +import FeeBadge, { FeeBadgeContainer } from 'components/FeeBadge' export const DEFAULT_VAULT_SLIPPAGE_TOLERANCE = new Percent(50, 10_000) @@ -339,6 +341,7 @@ export default function Vault({ className }: { className?: string }) { const { data: allVaults, error: allVaultsError, isLoading: isAllVaultsLoading } = useAllVaults() const currentVault: any = allVaults && vaultIdFromUrl ? allVaults[vaultIdFromUrl] : {} + console.log('currentVault', currentVault) const currency0: any = useCurrency(currentVault?.token0?.address, chainId) const currency1: any = useCurrency(currentVault?.token1?.address, chainId) const vaultState = useVaultState() @@ -435,23 +438,23 @@ export default function Vault({ className }: { className?: string }) { } default: { const performanceData = currentVault.performance[currentVault.mainAssetKey] - const token0 = new Token( + const token0: any = new Token( currentVault.token0.chainId, currentVault.token0.address, currentVault.token0.decimals, currentVault.token0.symbol, currentVault.token0.name ) - // token0.logoURI = currentVault.token0.logoURI + token0.logoURI = currentVault.token0.logoURI - const token1 = new Token( + const token1: any = new Token( currentVault.token1.chainId, currentVault.token1.address, currentVault.token1.decimals, currentVault.token1.symbol, currentVault.token1.name ) - // token1.logoURI = currentVault.token1.logoURI + token1.logoURI = currentVault.token1.logoURI let tvl let apr @@ -485,6 +488,13 @@ export default function Vault({ className }: { className?: string }) { return ( + + + + {token0?.symbol}-{token1?.symbol} + + {currentVault.feeTier} + @@ -585,11 +595,21 @@ export default function Vault({ className }: { className?: string }) { - {currency0?.symbol} - {totalToken1Amount ? totalToken0Amount?.toSignificant() : 0} + + {currency0 && ( + + )} + {currency0?.symbol} + + {totalToken0Amount ? totalToken0Amount?.toSignificant() : 0} - {currency1?.symbol} + + {currency1 && ( + + )} + {currency1?.symbol} + {totalToken1Amount ? totalToken1Amount?.toSignificant() : 0}