-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 🐛 Fix the pool tvl display when amount > 1B (#10896)
<!-- Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md) first --> <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces a new component, `PoolTvlWarning`, to display warnings about TVL and APR data accuracy in the `PoolInfo` view. It also updates localization strings to include a new warning message. ### Detailed summary - Added `PoolTvlWarning` component in `PoolInfo.tsx`. - Integrated `PoolTvlWarning` into the `PoolInfo` layout. - Updated localization in `translations.json` to include: - New warning message about TVL and APR data. - Added context for users regarding the accuracy of data. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
apps/web/src/views/PoolDetail/components/PoolTvlWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getChainName } from '@pancakeswap/chains' | ||
import { Protocol } from '@pancakeswap/farms' | ||
import { useTranslation } from '@pancakeswap/localization' | ||
import { Message, MessageText, Text } from '@pancakeswap/uikit' | ||
import { PoolInfo } from 'state/farmsV4/state/type' | ||
import { TextLink } from 'views/Ifos/components/IfoCardStyles' | ||
import { useRouterQuery } from '../hooks/useRouterQuery' | ||
|
||
const ONE_BILLION = 1_000_000_000 | ||
export const PoolTvlWarning = ({ poolInfo }: { poolInfo: PoolInfo }) => { | ||
const { t } = useTranslation() | ||
const { id, chainId } = useRouterQuery() | ||
const tvlUsd = parseFloat(poolInfo.tvlUsd ?? '0') | ||
const { protocol } = poolInfo | ||
const chain = getChainName(chainId) | ||
|
||
const version = `${protocol === Protocol.V3 ? '/v3/' : ''}` | ||
const stableSwap = `${protocol === Protocol.STABLE ? '?type=stableSwap' : ''}` | ||
const link = `https://pancakeswap.finance/info/${version}${chain}/pairs/${id}${stableSwap}` | ||
if (tvlUsd < ONE_BILLION) { | ||
return null | ||
} | ||
return ( | ||
<Message my="24px" mx="24px" variant="warning"> | ||
<MessageText fontSize="17px"> | ||
<Text color="warning" as="span"> | ||
{t('TVL and APR data may not be reflected correctly due to technical limitation, please refer to')}{' '} | ||
<TextLink target="_blank" href={link}> | ||
{t('info page')} | ||
</TextLink>{' '} | ||
{t('for accurate values')} | ||
</Text> | ||
</MessageText> | ||
</Message> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters