-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ifo for solv #11116
base: develop
Are you sure you want to change the base?
feat: add ifo for solv #11116
Changes from all commits
0d2422d
645420f
303b84d
9a2fc1b
175b0a6
e0aa398
c2afc6e
107964f
4b6c77f
ffe9cbb
5d4c7b3
8a012f1
6a159c4
8aaf60b
a2ebb47
41f7e0b
354cadc
a09e690
97eec1d
ee47a31
23db1ad
45ab95c
a2987c6
b4850ef
c0fe4c5
6aabb7b
3bf5e8f
a62fa36
163c43e
489304d
d7d0f0b
715e3b5
e3c7fbf
239061d
e80e4eb
89d130a
2a95b4c
ea505a3
e2fb541
b2e5168
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useTranslation } from '@pancakeswap/localization' | ||
import { BodyText } from '../BodyText' | ||
import { AdButton } from '../Button' | ||
import { AdCard } from '../Card' | ||
import { Countdown } from '../Countdown' | ||
import { AdPlayerProps } from '../types' | ||
import { getImageUrl } from '../utils' | ||
|
||
export const AdSolv = (props: AdPlayerProps) => { | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<AdCard imageUrl={getImageUrl('solv')} {...props}> | ||
<BodyText mb="8px"> | ||
{t('%token% IFO starts in', { | ||
token: 'SOLV', | ||
})} | ||
</BodyText> | ||
|
||
<Countdown | ||
targetTime={new Date('2025-01-16T10:00:00Z').getTime() / 1000} | ||
subtleColor="rgba(0,0,0,.6)" | ||
background="linear-gradient(180deg, #FCC631 0%, #FF9D00 100%)" | ||
color="black" | ||
mb="8px" | ||
/> | ||
|
||
<AdButton variant="text" isExternalLink href="https://pancakeswap.finance/ifo"> | ||
{t('Get Started')} | ||
</AdButton> | ||
</AdCard> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { useTranslation } from '@pancakeswap/localization' | ||
import { Box, Link, Text } from '@pancakeswap/uikit' | ||
import { VerticalDivider } from '@pancakeswap/widgets-internal' | ||
|
||
const TextHighlight = ({ text, highlights }: { text: string; highlights: string[] }) => { | ||
const prts = text.split(new RegExp(`(${highlights.join('|')})`, 'g')) | ||
return prts.map((prt, i) => { | ||
const key = `${prt}-${i}` | ||
if (highlights.includes(prt)) { | ||
return ( | ||
<Text bold as="span" color="#FCC631" fontSize={['12px', '12px', '14px']} key={key}> | ||
{prt} | ||
</Text> | ||
) | ||
} | ||
return ( | ||
<Text bold as="span" color="#FFFFFF" fontSize={['12px', '12px', '14px']} key={key}> | ||
{prt} | ||
</Text> | ||
) | ||
}) | ||
} | ||
export const SolvStrip = () => { | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<Box mr={['6px']}> | ||
<TextHighlight | ||
text={t('Join the SOLV Token Launch (IFO) on BNB Chain PancakeSwap')} | ||
highlights={['SOLV', 'PancakeSwap']} | ||
/>{' '} | ||
<Link | ||
external | ||
display="inline !important" | ||
fontSize={['12px', '12px', '14px']} | ||
href="https://pancakeswap.finance/ifo" | ||
> | ||
{t('Join Now')} | ||
</Link> | ||
<VerticalDivider | ||
bg="#53DEE9" | ||
style={{ | ||
display: 'inline-block', | ||
verticalAlign: 'middle', | ||
height: '18px', | ||
opacity: 0.4, | ||
width: '1px', | ||
marginLeft: '0px', | ||
marginRight: '8px', | ||
}} | ||
/> | ||
<Link | ||
external | ||
display="inline !important" | ||
fontSize={['12px', '12px', '14px']} | ||
href="https://forum.pancakeswap.finance/t/solv-ifo-discussion-thread/993" | ||
> | ||
{t('Learn More')} | ||
</Link> | ||
</Box> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import { CAKE } from '@pancakeswap/tokens' | |
import { Box, Flex, IfoSkeletonCardDetails, Skeleton, Text, TooltipText, useTooltip } from '@pancakeswap/uikit' | ||
import { BIG_ONE_HUNDRED } from '@pancakeswap/utils/bigNumber' | ||
import { formatNumber, getBalanceNumber } from '@pancakeswap/utils/formatBalance' | ||
import { DAY_IN_SECONDS } from '@pancakeswap/utils/getTimePeriods' | ||
import BigNumber from 'bignumber.js' | ||
import { useStablecoinPrice } from 'hooks/useStablecoinPrice' | ||
import { ReactNode, useMemo } from 'react' | ||
|
@@ -141,6 +140,20 @@ const MaxTokenEntry = ({ | |
) | ||
} | ||
|
||
function timeUntilDiffTime(diffTime: number): string { | ||
if (diffTime <= 0) { | ||
return 'The time has already passed.' | ||
} | ||
|
||
const diffInHours = Math.floor(diffTime / (60 * 60)) | ||
const diffInDays = Math.floor(diffInHours / 24) | ||
|
||
if (diffInDays >= 1) { | ||
return `${diffInDays} day(s)` | ||
} | ||
return `${diffInHours} hour(s)` | ||
} | ||
|
||
const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = ({ | ||
isEligible, | ||
poolId, | ||
|
@@ -220,7 +233,8 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = ( | |
) | ||
|
||
const durationInSeconds = ifo.version >= 3.2 ? poolCharacteristic?.vestingInformation?.duration ?? 0 : 0 | ||
const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS) | ||
// const vestingDays = Math.ceil(durationInSeconds / DAY_IN_SECONDS) | ||
const vestingCountdown = timeUntilDiffTime(durationInSeconds) | ||
|
||
/* Format end */ | ||
const renderBasedOnIfoStatus = () => { | ||
|
@@ -276,9 +290,9 @@ const IfoCardDetails: React.FC<React.PropsWithChildren<IfoCardDetailsProps>> = ( | |
/> | ||
<FooterEntry | ||
label={t('Vesting schedule:')} | ||
value={`${vestingDays} days`} | ||
tooltipContent={t('The vested tokens will be released linearly over a period of %days% days.', { | ||
days: vestingDays, | ||
value={vestingCountdown} | ||
tooltipContent={t('The vested tokens will be released linearly over a period of %countdown%.', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tooltip content wouldn't look good when value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. vestingCountdown is in the format of {number} day(s) or hour(s) |
||
countdown: vestingCountdown, | ||
})} | ||
/> | ||
</> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plannedStartTime of the ifo can be used here