Skip to content

Commit

Permalink
feat: Update Next distribution logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefMomota committed Jul 28, 2023
1 parent 4240ac7 commit e448fc9
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Balance,
NextLinkFromReactRouter,
} from '@pancakeswap/uikit'
import { ONE_WEEK_DEFAULT } from '@pancakeswap/pools'
import { useVaultPoolByKey } from 'state/pools/hooks'
import { timeFormat } from 'views/TradingReward/utils/timeFormat'
import useRevenueSharingPool from 'views/Pools/hooks/useRevenueSharingPool'
Expand Down Expand Up @@ -50,10 +51,10 @@ const RevenueSharing: React.FunctionComponent<React.PropsWithChildren<RevenueSha
[availableCake, cakePriceBusd],
)

const showExpireSoonWarning = useMemo(
() => new BigNumber(userData?.lockEndTime ?? '0').lt(nextDistributionTimestamp),
[nextDistributionTimestamp, userData?.lockEndTime],
)
const showExpireSoonWarning = useMemo(() => {
const endTime = new BigNumber(nextDistributionTimestamp).plus(ONE_WEEK_DEFAULT)
return new BigNumber(userData?.lockEndTime ?? '0').lt(endTime)
}, [nextDistributionTimestamp, userData?.lockEndTime])

const showNoCakeAmountWarning = useMemo(
() => new BigNumber(userData?.lockedAmount ?? '0').lte(0),
Expand Down Expand Up @@ -131,7 +132,14 @@ const RevenueSharing: React.FunctionComponent<React.PropsWithChildren<RevenueSha
{showExpireSoonWarning && (
<Message variant="danger" padding="8px" mt="8px" icon={<WarningIcon color="failure" />}>
<MessageText lineHeight="120%">
{t('Your fixed-term staking position will expire before the next revenue sharing distributions.')}
<Text fontSize="14px" color="failure">
{t(
'Your fixed-term staking position will have less than 1 week in remaining duration upon the next distribution.',
)}
</Text>
<Text fontSize="14px" color="failure" mt="4px">
{t('Extend your stakings to receive shares in the next distribution.')}
</Text>
</MessageText>
</Message>
)}
Expand Down

0 comments on commit e448fc9

Please sign in to comment.