-
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.
<!-- 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
1 parent
9d25dbf
commit fd7ea4a
Showing
6 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
apps/web/src/views/Farms/components/CustomTooltips/TaikoEthTooltips.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,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} | ||
</> | ||
) | ||
} |
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
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
23 changes: 23 additions & 0 deletions
23
apps/web/src/views/Farms/hooks/useHasCustomFarmLpTooltips.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,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]) | ||
} |
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
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