diff --git a/tinlake-ui/components/Chart/styles.ts b/tinlake-ui/components/Chart/styles.ts index 757e09bccd..9eb2aaee85 100644 --- a/tinlake-ui/components/Chart/styles.ts +++ b/tinlake-ui/components/Chart/styles.ts @@ -1,4 +1,10 @@ +import { ResponsiveContainer } from 'recharts' import styled from 'styled-components' + +export const StyledResponsiveContainer = styled(ResponsiveContainer)` + width: calc(100% + 8px) !important; + margin-left: -4px; +` export const ChartTooltip = styled.div` padding: 12px 16px; font-size: 12px; diff --git a/tinlake-ui/components/Header/index.tsx b/tinlake-ui/components/Header/index.tsx index 55a1ab5731..677696a0e4 100644 --- a/tinlake-ui/components/Header/index.tsx +++ b/tinlake-ui/components/Header/index.tsx @@ -1,4 +1,3 @@ -import { Tooltip as AxisTooltip } from '@centrifuge/axis-tooltip' import { baseToDisplay } from '@centrifuge/tinlake-js' import { Box, Button, Layer } from 'grommet' import { Close as CloseIcon, Menu as MenuIcon } from 'grommet-icons' @@ -19,6 +18,7 @@ import { getAddressLink } from '../../utils/etherscanLinkGenerator' import { toDynamicPrecision } from '../../utils/toDynamicPrecision' import { useCFGRewards } from '../../utils/useCFGRewards' import { useQueryDebugEthAddress } from '../../utils/useQueryDebugEthAddress' +import { Tooltip } from '../Tooltip' import { Web3Wallet } from '../Web3Wallet' const { isDemo } = config @@ -159,11 +159,11 @@ const Header: React.FC = (props: Props) => { - {rewardsLink} + {rewardsLink} {address && ( - {portfolioLink} + {portfolioLink} )} diff --git a/tinlake-ui/components/Overview/OverviewHeader.tsx b/tinlake-ui/components/Overview/OverviewHeader.tsx index b3ac5744ae..86186ab9f9 100644 --- a/tinlake-ui/components/Overview/OverviewHeader.tsx +++ b/tinlake-ui/components/Overview/OverviewHeader.tsx @@ -120,48 +120,50 @@ const OverviewHeader: React.FC = (props: Props) => { {props.selectedPool.metadata.asset} Asset type - - - {props.selectedPool.metadata.assetMaturity} - Asset maturity - - - - - - - {dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0)) - ? dropYield - : toPrecision(feeToInterestRate(dropRate || '0'), 2)} - % - - {dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0)) && ( - - DROP APY (30 days) - - )} - {!(dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0))) && ( - - Fixed DROP rate (APR) - - )} - - - - - - - {addThousandsSeparators( - toPrecision( - baseToDisplay((poolData?.netAssetValue || new BN(0)).add(poolData?.reserve || new BN(0)), 18), - 0 - ) + + {props.selectedPool.metadata.assetMaturity} + + + Asset maturity + + + + + + + {dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0)) + ? dropYield + : toPrecision(feeToInterestRate(dropRate || '0'), 2)} + % + + + + {dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0)) && ( + + DROP APY (30 days) + )} - {props.selectedPool.metadata.currencySymbol} - - Pool Value - - + {!(dropYield && (poolData?.netAssetValue.gtn(0) || poolData?.reserve.gtn(0))) && ( + + Fixed DROP rate (APR) + + )} + + + + + + + {addThousandsSeparators( + toPrecision( + baseToDisplay((poolData?.netAssetValue || new BN(0)).add(poolData?.reserve || new BN(0)), 18), + 0 + ) + )} + {props.selectedPool.metadata.currencySymbol} + + Pool Value + {'addresses' in props.selectedPool && config.featureFlagNewOnboardingPools.includes(props.selectedPool.addresses.ROOT_CONTRACT) ? ( diff --git a/tinlake-ui/components/PoolCapacityLabel/index.tsx b/tinlake-ui/components/PoolCapacityLabel/index.tsx index 836b8e94a8..6eabd5a76b 100644 --- a/tinlake-ui/components/PoolCapacityLabel/index.tsx +++ b/tinlake-ui/components/PoolCapacityLabel/index.tsx @@ -1,5 +1,4 @@ import { addThousandsSeparators, baseToDisplay, toPrecision } from '@centrifuge/tinlake-js' -import BN from 'bn.js' import * as React from 'react' import styled from 'styled-components' import { PoolData } from '../../ducks/pools' @@ -25,9 +24,13 @@ export const PoolCapacityLabel: React.FC = ({ pool }) => { return } + if (capacity == null) { + return null + } + return ( ) } diff --git a/tinlake-ui/components/PoolsMetrics/index.tsx b/tinlake-ui/components/PoolsMetrics/index.tsx index 9f5aa20104..1416b8da2a 100644 --- a/tinlake-ui/components/PoolsMetrics/index.tsx +++ b/tinlake-ui/components/PoolsMetrics/index.tsx @@ -1,14 +1,14 @@ -import { Tooltip as AxisTooltip } from '@centrifuge/axis-tooltip' import { baseToDisplay, ITinlake } from '@centrifuge/tinlake-js' import { Box, Button } from 'grommet' import { useRouter } from 'next/router' import * as React from 'react' import { useSelector } from 'react-redux' -import { Area, AreaChart, ResponsiveContainer, Tooltip, YAxis } from 'recharts' +import { Area, AreaChart, ResponsiveContainer, Tooltip as ChartTooltip, YAxis } from 'recharts' import { PoolsDailyData, PoolsData } from '../../ducks/pools' import { dateToYMD } from '../../utils/date' import { useCFGYield } from '../../utils/hooks' import NumberDisplay from '../NumberDisplay' +import { Tooltip } from '../Tooltip' import { Cont, Label, TokenLogo, Unit, Value } from './styles' interface Props { @@ -40,8 +40,8 @@ const PoolsMetrics: React.FC = (props: Props) => { elevation="small" round="xsmall" background="white" - margin={{ horizontal: '16px', top: 'medium' }} - style={{ flex: '1 1 300px', maxWidth: '430px' }} + margin={{ horizontal: '16px' }} + style={{ flex: '1 1 300px', maxWidth: '440px' }} direction="row" pad="medium" > @@ -67,7 +67,7 @@ const PoolsMetrics: React.FC = (props: Props) => { - } /> + } /> {/* dateToYMD(val)} /> */} = (props: Props) => { elevation="small" round="xsmall" background="white" - margin={{ horizontal: '16px', top: 'medium' }} - style={{ flex: '1 1 300px', maxWidth: '430px' }} + margin={{ horizontal: '16px' }} + style={{ flex: '1 1 300px', maxWidth: '440px' }} direction="row" pad="medium" justify="center" > - - <> - - - - - {' '} - % - + <> + + + + + {' '} + % + + - - + +