Skip to content

Commit

Permalink
feat: List new farm (#9981)
Browse files Browse the repository at this point in the history
<!--
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 adds custom tooltips for specific Farm LPs in the UI components.
It introduces a new custom tooltip for the Taiko-ETH LP and updates
translations.

### Detailed summary
- Added custom tooltips for specific Farm LPs
- Introduced a new custom tooltip for the Taiko-ETH LP
- Updated translations for a better user experience

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
ChefMomota authored Jun 11, 2024
1 parent 9d25dbf commit fd7ea4a
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { useTranslation } from '@pancakeswap/localization'
import { Box, InfoFilledIcon, LinkExternal, Text, useTooltip } from '@pancakeswap/uikit'
import styled from 'styled-components'

const InlineLink = styled(LinkExternal)`
display: inline-flex;
margin-left: 4px;
`

export const TaikoEthTooltips = () => {
const { t } = useTranslation()

const { tooltip, tooltipVisible, targetRef } = useTooltip(
<Box>
<Text display="inline" color="currentColor">
{t('Users are encouraged to try out')}
<InlineLink m="0 4px 0 0" external display="inline" href="https://bridge.taiko.xyz/">
{t('Taiko')}
</InlineLink>
{t('ahead of any potential PancakeSwap Affiliate deployment')}
</Text>
</Box>,
{
placement: 'top-start',
tooltipOffset: [-20, 10],
},
)

return (
<>
<Box ref={targetRef} width="20px" height="20px">
<InfoFilledIcon color="#6532CD" width="20px" height="20px" />
</Box>
{tooltipVisible ? tooltip : null}
</>
)
}
4 changes: 4 additions & 0 deletions apps/web/src/views/Farms/components/FarmCard/CardHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useHasSwellReward } from 'hooks/useHasSwellReward'
import { styled } from 'styled-components'
import { Address, isAddressEqual } from 'viem'
import { bsc } from 'viem/chains'
import { useHasCustomFarmLpTooltips } from 'views/Farms/hooks/useHasCustomFarmLpTooltips'
import { useChainId } from 'wagmi'
import BoostedTag from '../YieldBooster/components/BoostedTag'

Expand Down Expand Up @@ -82,6 +83,8 @@ const CardHeading: React.FC<React.PropsWithChildren<ExpandableSectionProps>> = (
const chainId = useChainId()
const isReady = multiplier !== undefined || bCakeWrapperAddress
const hasSwellReward = useHasSwellReward(lpAddress)
const customTooltips = useHasCustomFarmLpTooltips(lpAddress)

const multiplierTooltipContent = FarmMultiplierInfo({
farmCakePerSecond: farmCakePerSecond ?? '-',
totalMultipliers: totalMultipliers ?? '-',
Expand Down Expand Up @@ -147,6 +150,7 @@ const CardHeading: React.FC<React.PropsWithChildren<ExpandableSectionProps>> = (
)}
<AutoRow gap="4px" justifyContent="flex-end">
{hasSwellReward && <SwellTooltip />}
{customTooltips && customTooltips.tooltips}
{isReady && isStable ? <StableFarmTag /> : version === 2 ? <V2Tag /> : null}
{isReady && version === 3 && <V3FeeTag feeAmount={feeAmount} />}
{isReady && isCommunityFarm && <FarmAuctionTag mr="-4px" />}
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/views/Farms/components/FarmTable/Farm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useHasSwellReward } from 'hooks/useHasSwellReward'
import { useMemo } from 'react'
import { Address, isAddressEqual } from 'viem'
import { bsc } from 'viem/chains'
import { useHasCustomFarmLpTooltips } from 'views/Farms/hooks/useHasCustomFarmLpTooltips'

const { FarmTokenInfo } = FarmWidget.FarmTable

Expand All @@ -30,6 +31,8 @@ export const FarmCell: React.FunctionComponent<
}) => {
const { t } = useTranslation()
const hasSwellReward = useHasSwellReward(lpAddress)
const customTooltips = useHasCustomFarmLpTooltips(lpAddress)

const hasUsdPlusWarning = useMemo(() => {
return zksyncTokens.usdPlus.equals(token) || zksyncTokens.usdPlus.equals(quoteToken)
}, [token, quoteToken])
Expand Down Expand Up @@ -77,6 +80,7 @@ export const FarmCell: React.FunctionComponent<
<SwellTooltip />
</Box>
)}
{customTooltips && <Box marginLeft={1}>{customTooltips.tooltips}</Box>}
{hasUsdPlusWarning ? <USDPlusWarningTooltip /> : null}
</Flex>
)
Expand Down
23 changes: 23 additions & 0 deletions apps/web/src/views/Farms/hooks/useHasCustomFarmLpTooltips.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useMemo } from 'react'
import type { Address } from 'viem'
import { TaikoEthTooltips } from 'views/Farms/components/CustomTooltips/TaikoEthTooltips'

/**
* List Farm LPs custom tooltips
*/
interface CustomTooltipsType {
identifier: Address
tooltips: JSX.Element
}

const CONTRACTS_LP_WITH_TOOLTIPS: CustomTooltipsType[] = [
{
// Taiko-ETH LP
identifier: '0x05dF8F9fCFf0b6a6FDE7166706a52693906C9936',
tooltips: <TaikoEthTooltips />,
},
]

export function useHasCustomFarmLpTooltips(id?: Address) {
return useMemo(() => CONTRACTS_LP_WITH_TOOLTIPS.find(({ identifier }) => identifier === id), [id])
}
7 changes: 7 additions & 0 deletions packages/farms/constants/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export const farmsV3 = defineFarmV3Configs([
...v3TopFixedLps,
// new lps should follow after the top fixed lps
// latest first
{
pid: 71,
lpAddress: '0x05dF8F9fCFf0b6a6FDE7166706a52693906C9936',
token0: ethereumTokens.taiko,
token1: ethereumTokens.weth,
feeAmount: FeeAmount.HIGH,
},
{
pid: 70,
lpAddress: '0x6FD5029Ba47BA8dBee130DA71e2546b5c96b4B12',
Expand Down
5 changes: 4 additions & 1 deletion packages/localization/src/config/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -3385,5 +3385,8 @@
"Pay gas on zkSync Era PancakeSwap with 10+ ERC-20 tokens": "Pay gas on zkSync Era PancakeSwap with 10+ ERC-20 tokens",
"Enjoy Gas-Free Transactions on zkSync PancakeSwap": "Enjoy Gas-Free Transactions on zkSync PancakeSwap",
"Enjoy Gas-Free Transactions on zkSync Era PancakeSwap": "Enjoy Gas-Free Transactions on zkSync Era PancakeSwap",
"Overnight has temporarily paused USD+ operations on zkSync due to the recent Velocore exploit.Swap, approve, and add / remove liquidity functions are currently unavailable. More information can be found on Overnight's": "Overnight has temporarily paused USD+ operations on zkSync due to the recent Velocore exploit.Swap, approve, and add / remove liquidity functions are currently unavailable. More information can be found on Overnight's"
"Overnight has temporarily paused USD+ operations on zkSync due to the recent Velocore exploit.Swap, approve, and add / remove liquidity functions are currently unavailable. More information can be found on Overnight's": "Overnight has temporarily paused USD+ operations on zkSync due to the recent Velocore exploit.Swap, approve, and add / remove liquidity functions are currently unavailable. More information can be found on Overnight's",
"Users are encouraged to try out": "Users are encouraged to try out",
"Taiko": "Taiko",
"ahead of any potential PancakeSwap Affiliate deployment": "ahead of any potential PancakeSwap Affiliate deployment"
}

0 comments on commit fd7ea4a

Please sign in to comment.