Skip to content

Commit

Permalink
fix: Unapproved pool does not show enable button (pancakeswap#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chef-Cheems authored May 6, 2021
1 parent c061d29 commit 908d473
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
10 changes: 2 additions & 8 deletions src/views/Pools/components/PoolCard/CardActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,18 @@ const InlineText = styled(Text)`
interface CardActionsProps {
pool: Pool
stakedBalance: BigNumber
accountHasStakedBalance: boolean
stakingTokenPrice: number
}

const CardActions: React.FC<CardActionsProps> = ({
pool,
stakedBalance,
accountHasStakedBalance,
stakingTokenPrice,
}) => {
const CardActions: React.FC<CardActionsProps> = ({ pool, stakedBalance, stakingTokenPrice }) => {
const { sousId, stakingToken, earningToken, harvest, poolCategory, userData } = pool
// Pools using native BNB behave differently than pools using a token
const isBnbPool = poolCategory === PoolCategory.BINANCE
const { t } = useTranslation()
const allowance = userData?.allowance ? new BigNumber(userData.allowance) : BIG_ZERO
const stakingTokenBalance = userData?.stakingTokenBalance ? new BigNumber(userData.stakingTokenBalance) : BIG_ZERO
const earnings = userData?.pendingReward ? new BigNumber(userData.pendingReward) : BIG_ZERO
const needsApproval = !accountHasStakedBalance && !allowance.gt(0) && !isBnbPool
const needsApproval = !allowance.gt(0) && !isBnbPool
const isStaked = stakedBalance.gt(0)
const isLoading = !userData

Expand Down
7 changes: 1 addition & 6 deletions src/views/Pools/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ const PoolCard: React.FC<{ pool: Pool; account: string }> = ({ pool, account })
<AprRow pool={pool} stakingTokenPrice={stakingTokenPrice} />
<Flex mt="24px" flexDirection="column">
{account ? (
<CardActions
pool={pool}
stakedBalance={stakedBalance}
stakingTokenPrice={stakingTokenPrice}
accountHasStakedBalance={accountHasStakedBalance}
/>
<CardActions pool={pool} stakedBalance={stakedBalance} stakingTokenPrice={stakingTokenPrice} />
) : (
<>
<Text mb="10px" textTransform="uppercase" fontSize="12px" color="textSubtle" bold>
Expand Down

0 comments on commit 908d473

Please sign in to comment.