调整军团长,董事会
This commit is contained in:
parent
7b1748ac3e
commit
1640396dc7
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 689 KiB After Width: | Height: | Size: 424 KiB |
|
|
@ -116,7 +116,7 @@
|
||||||
"Total jackpot this round": "此回合的总累积奖池",
|
"Total jackpot this round": "此回合的总累积奖池",
|
||||||
"Collect Winnings": "收集奖金",
|
"Collect Winnings": "收集奖金",
|
||||||
"Buy Tickets": "购买彩票",
|
"Buy Tickets": "购买彩票",
|
||||||
"Harvest": "收割",
|
"Harvest": "领取收益",
|
||||||
"Approve": "批准",
|
"Approve": "批准",
|
||||||
"Select": "选择",
|
"Select": "选择",
|
||||||
"Winning Numbers This Round": "此回合的中奖号码",
|
"Winning Numbers This Round": "此回合的中奖号码",
|
||||||
|
|
@ -1131,5 +1131,12 @@
|
||||||
"top": "置顶",
|
"top": "置顶",
|
||||||
"Cancel the pledge": "取消质押",
|
"Cancel the pledge": "取消质押",
|
||||||
"Forced to cancel": "强制取消质押",
|
"Forced to cancel": "强制取消质押",
|
||||||
"End of the lock up": "锁仓结束"
|
"End of the lock up": "锁仓结束",
|
||||||
|
"Get the benefits": "领取收益",
|
||||||
|
"license agreement": "授权合约",
|
||||||
|
"Minimum amount pledged": "最小质押金额",
|
||||||
|
"Holder": "持币人",
|
||||||
|
"Board": "董事会",
|
||||||
|
"Whether to cancel": "是否取消",
|
||||||
|
"Please enter a number": "请输入数字"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default {
|
||||||
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
||||||
},
|
},
|
||||||
boardChef: {
|
boardChef: {
|
||||||
97: '0x733240108a3626f6f4871328f168281040655d08',
|
97: '0xe477990fc68d93472e2cc4b1aae21fe30f602c9a',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
||||||
},
|
},
|
||||||
boardRewardChef: {
|
boardRewardChef: {
|
||||||
|
|
|
||||||
|
|
@ -1258,5 +1258,12 @@
|
||||||
"top": "top",
|
"top": "top",
|
||||||
"Cancel the pledge": "Cancel the pledge",
|
"Cancel the pledge": "Cancel the pledge",
|
||||||
"Forced to cancel": "Forced to cancel",
|
"Forced to cancel": "Forced to cancel",
|
||||||
"End of the lock up": "End of the lock up"
|
"End of the lock up": "End of the lock up",
|
||||||
|
"Get the benefits": "Get the benefits",
|
||||||
|
"license agreement": "license agreement",
|
||||||
|
"Minimum amount pledged": "Minimum amount pledged",
|
||||||
|
"Holder": "Holder",
|
||||||
|
"Board": "Board",
|
||||||
|
"Whether to cancel": "Whether to cancel",
|
||||||
|
"Please enter a number": "Please enter a number"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,7 @@ export interface Boards extends BoardConfig {
|
||||||
stakedBalance: number
|
stakedBalance: number
|
||||||
unlockTime: number
|
unlockTime: number
|
||||||
estimatedProfit: number
|
estimatedProfit: number
|
||||||
|
receiveReward: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface BoardsState {
|
export interface BoardsState {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
import React, { useCallback, useMemo, useState } from 'react'
|
||||||
|
import { Button, Modal, Text } from '@pancakeswap/uikit'
|
||||||
|
import { ModalActions, ModalInput } from 'components/Modal'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import useToast from 'hooks/useToast'
|
||||||
|
import { getFullDisplayBalance } from 'utils/formatBalance'
|
||||||
|
|
||||||
|
interface AffirmModalProps {
|
||||||
|
title?: string
|
||||||
|
content?: string
|
||||||
|
onDismiss?: () => void
|
||||||
|
handSubmit?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const DepositModal: React.FC<AffirmModalProps> = ({ title, content, onDismiss, handSubmit }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
const submit = async () => {
|
||||||
|
await handSubmit()
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Modal title={t(`${title}`)} onDismiss={onDismiss}>
|
||||||
|
<Text>{!content ? t('Whether to cancel') : content}</Text>
|
||||||
|
<ModalActions>
|
||||||
|
<Button variant="secondary" onClick={onDismiss} width="100%">
|
||||||
|
{t('Cancel')}
|
||||||
|
</Button>
|
||||||
|
<Button width="100%" onClick={submit}>
|
||||||
|
{t('Confirm')}
|
||||||
|
</Button>
|
||||||
|
</ModalActions>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DepositModal
|
||||||
|
|
@ -88,16 +88,21 @@ const CardDiv = styled.div`
|
||||||
const ContentDiv = styled.div`
|
const ContentDiv = styled.div`
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
`
|
`
|
||||||
|
const InfoDiv = styled(Flex)`
|
||||||
|
flex-direction: column;
|
||||||
|
height: 60px;
|
||||||
|
justify-content: space-between;
|
||||||
|
`
|
||||||
|
|
||||||
interface NodeCardProps {
|
interface NodeCardProps {
|
||||||
board: any
|
board: any
|
||||||
removed: boolean
|
removed: boolean
|
||||||
provider?: ProviderType
|
provider?: ProviderType
|
||||||
account?: string
|
accountData?: string
|
||||||
boardsData?: any
|
boardsData?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
const BoardCard: React.FC<NodeCardProps> = ({ board, account, boardsData }) => {
|
const BoardCard: React.FC<NodeCardProps> = ({ board, accountData, boardsData }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [countDown, setCountDown] = useState('')
|
const [countDown, setCountDown] = useState('')
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -137,15 +142,14 @@ const BoardCard: React.FC<NodeCardProps> = ({ board, account, boardsData }) => {
|
||||||
amount={board.userData?.amount}
|
amount={board.userData?.amount}
|
||||||
/>
|
/>
|
||||||
<ContentDiv>
|
<ContentDiv>
|
||||||
{account && (
|
{accountData && (
|
||||||
<div>
|
<InfoDiv>
|
||||||
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount as number} />
|
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount as number} />
|
||||||
{board.pid === 1 && board.userData?.amount ? <FlexText name={t('Lock up time')} value={countDown} /> : ''}
|
{board.pid === 1 && board.userData?.amount ? <FlexText name={t('Lock up time')} value={countDown} /> : ''}
|
||||||
{/* <FlexText name={t('possess LP')} value={board.userData?.amount} /> */}
|
|
||||||
<FlexText name={t('possess LP')} value={board.userData?.amount / boardsData?.curAmount || 0} />
|
<FlexText name={t('possess LP')} value={board.userData?.amount / boardsData?.curAmount || 0} />
|
||||||
</div>
|
</InfoDiv>
|
||||||
)}
|
)}
|
||||||
<CardActionsContainer board={board} account={account} />
|
<CardActionsContainer board={board} accountData={accountData} />
|
||||||
</ContentDiv>
|
</ContentDiv>
|
||||||
{/* <Divider />
|
{/* <Divider />
|
||||||
<ExpandableSectionButton
|
<ExpandableSectionButton
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useCallback } from 'react'
|
import React, { useState, useCallback, useMemo } from 'react'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { provider as ProviderType } from 'web3-core'
|
import { provider as ProviderType } from 'web3-core'
|
||||||
|
|
@ -6,35 +6,50 @@ import { getAddress } from 'utils/addressHelpers'
|
||||||
import { Button, Flex, Text } from '@pancakeswap/uikit'
|
import { Button, Flex, Text } from '@pancakeswap/uikit'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { Boards } from 'state/types'
|
import { Boards } from 'state/types'
|
||||||
import { useBoardUser } from 'state/hooks'
|
import { useBoardUser, usePriceCakeBusd, usePriceHccUsdt } from 'state/hooks'
|
||||||
import { TOKEN_SYMBOL } from 'config/index'
|
import { TOKEN_SYMBOL } from 'config/index'
|
||||||
import { getBalanceNumber } from 'utils/formatBalance'
|
|
||||||
|
import { useWeb3React } from '@web3-react/core'
|
||||||
|
import { BIG_ZERO } from 'utils/bigNumber'
|
||||||
|
|
||||||
|
import { getBalanceNumber, getBalanceAmount } from 'utils/formatBalance'
|
||||||
import { useERC20 } from 'hooks/useContract'
|
import { useERC20 } from 'hooks/useContract'
|
||||||
import UnlockButton from 'components/UnlockButton'
|
import UnlockButton from 'components/UnlockButton'
|
||||||
import useApproveBoard from '../../hooks/useApproveBoard'
|
import useApproveBoard from '../../hooks/useApproveBoard'
|
||||||
import StakeAction from './StakeAction'
|
import StakeAction from './StakeAction'
|
||||||
import HarvestAction from './HarvestAction'
|
import HarvestAction from './HarvestAction'
|
||||||
|
|
||||||
|
import useHarvestBoard from '../../hooks/useHarvestBoard'
|
||||||
|
import FlexText from './FlexText'
|
||||||
|
|
||||||
const Action = styled.div`
|
const Action = styled.div`
|
||||||
padding-top: 16px;
|
padding-top: 4px;
|
||||||
|
`
|
||||||
|
const PriceCoin = styled.div`
|
||||||
|
text-align: right;
|
||||||
`
|
`
|
||||||
|
|
||||||
interface NodeCardActionsProps {
|
interface NodeCardActionsProps {
|
||||||
board: Boards
|
board: Boards
|
||||||
provider?: ProviderType
|
provider?: ProviderType
|
||||||
account?: string
|
accountData?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const CardActions: React.FC<NodeCardActionsProps> = ({ board, account }) => {
|
const CardActions: React.FC<NodeCardActionsProps> = ({ board, accountData }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [requestedApproval, setRequestedApproval] = useState(false)
|
const [requestedApproval, setRequestedApproval] = useState(false)
|
||||||
const pid = board.pid
|
const pid = board.pid
|
||||||
const { allowance, tokenBalance, stakedBalance, estimatedProfit } = useBoardUser(pid)
|
const { allowance, tokenBalance, stakedBalance, estimatedProfit } = useBoardUser(pid)
|
||||||
const isApproved = account && allowance && allowance.isGreaterThan(0)
|
const isApproved = accountData && allowance && allowance.isGreaterThan(0)
|
||||||
const tokenContract = useERC20(getAddress(board.tokenAddresses))
|
const tokenContract = useERC20(getAddress(board.tokenAddresses))
|
||||||
|
|
||||||
const { onApprove } = useApproveBoard(tokenContract, pid)
|
const { onApprove } = useApproveBoard(tokenContract, pid)
|
||||||
|
|
||||||
|
const { account } = useWeb3React()
|
||||||
|
const rawEarningsBalance = account ? getBalanceAmount(new BigNumber(estimatedProfit)).toNumber() : BIG_ZERO
|
||||||
|
const displayBalance = rawEarningsBalance.toFixed(3, BigNumber.ROUND_DOWN)
|
||||||
|
const hccPriceUsdt = usePriceHccUsdt()
|
||||||
|
|
||||||
const handleApprove = useCallback(async () => {
|
const handleApprove = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setRequestedApproval(true)
|
setRequestedApproval(true)
|
||||||
|
|
@ -44,34 +59,54 @@ const CardActions: React.FC<NodeCardActionsProps> = ({ board, account }) => {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}, [onApprove])
|
}, [onApprove])
|
||||||
|
const [totalPrice, setTotalPrice] = useState(0)
|
||||||
|
useMemo(() => {
|
||||||
|
setTotalPrice(getBalanceAmount(new BigNumber(board?.userData?.receiveReward)).toNumber() + Number(displayBalance))
|
||||||
|
}, [board])
|
||||||
|
|
||||||
const renderApprovalOrStakeButton = () => {
|
const renderApprovalOrStakeButton = () => {
|
||||||
return isApproved ? (
|
return isApproved ? (
|
||||||
<>
|
<>
|
||||||
<Flex>
|
<FlexText name={t('The total amount of dividends')} value={totalPrice.toFixed(3)} />
|
||||||
|
<Flex justifyContent="space-between" alignItems="center">
|
||||||
|
<Text fontSize="12px" color="#1FC7D4">
|
||||||
|
{t('Unclaimed income')}
|
||||||
|
</Text>
|
||||||
|
<PriceCoin>
|
||||||
|
<Text fontSize="16px" color="#1FC7D4">
|
||||||
|
{displayBalance}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="12px" color="#9BE5EB">
|
||||||
|
{(Number(hccPriceUsdt.toNumber().toFixed(3)) * Number(displayBalance)).toFixed(3)} USDT
|
||||||
|
</Text>
|
||||||
|
</PriceCoin>
|
||||||
|
</Flex>
|
||||||
|
{/* <FlexText name={t('Unclaimed income')} value={displayBalance} /> */}
|
||||||
|
{/* <Flex>
|
||||||
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
|
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
|
||||||
{board.tokenSymbol}
|
{board.tokenSymbol}
|
||||||
</Text>
|
</Text>
|
||||||
<Text bold textTransform="uppercase" color="textSubtle" fontSize="12px">
|
<Text bold textTransform="uppercase" color="textSubtle" fontSize="12px">
|
||||||
{t('Staked')}
|
{t('Staked')}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex> */}
|
||||||
<StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} board={board} />
|
|
||||||
<Flex flexDirection="column" alignItems="flex-start" mt="10">
|
|
||||||
<Text color="textSubtle" fontSize="12px">
|
|
||||||
{t('Unclaimed income')}
|
|
||||||
</Text>
|
|
||||||
<HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} />
|
<HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} />
|
||||||
</Flex>
|
<StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} board={board} />
|
||||||
|
{/* <Flex flexDirection="column" alignItems="flex-start" mt="10"> */}
|
||||||
|
{/* <Text color="textSubtle" fontSize="12px">
|
||||||
|
{t('Unclaimed income')}
|
||||||
|
</Text> */}
|
||||||
|
{/* <HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} /> */}
|
||||||
|
{/* </Flex> */}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button mt="8px" width="100%" disabled={requestedApproval} onClick={handleApprove}>
|
<Button mt="8px" width="100%" disabled={requestedApproval} onClick={handleApprove}>
|
||||||
{t('Approve Contract')}
|
{t('license agreement')}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Action>{!account ? <UnlockButton mt="8px" width="100%" /> : renderApprovalOrStakeButton()}</Action>
|
return <Action>{!accountData ? <UnlockButton mt="8px" width="100%" /> : renderApprovalOrStakeButton()}</Action>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default CardActions
|
export default CardActions
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol,
|
||||||
<Wrapper justifyContent="space-between" alignItems="center" mb="12px">
|
<Wrapper justifyContent="space-between" alignItems="center" mb="12px">
|
||||||
{/* <Image src={`/images/nodes/${img}.png`} width={64} height={64} /> */}
|
{/* <Image src={`/images/nodes/${img}.png`} width={64} height={64} /> */}
|
||||||
<HeaderFlex>
|
<HeaderFlex>
|
||||||
<Heading mb="4px">{name}</Heading>
|
<Heading mb="4px">{t(`${name}`)}</Heading>
|
||||||
{/* <Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> */}
|
{/* <Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> */}
|
||||||
</HeaderFlex>
|
</HeaderFlex>
|
||||||
{amount > 0 && account && (
|
{amount > 0 && account && (
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,15 @@ const HarvestAction: React.FC<FarmCardActionsProps> = ({ earnings, pid }) => {
|
||||||
const earningsBusd = rawEarningsBalance ? rawEarningsBalance.multipliedBy(cakePrice).toNumber() : 0
|
const earningsBusd = rawEarningsBalance ? rawEarningsBalance.multipliedBy(cakePrice).toNumber() : 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex width="100%" justifyContent="space-between" alignItems="center">
|
<Flex width="100%" marginTop={25} justifyContent="space-between" alignItems="center">
|
||||||
<Flex flexDirection="column" alignItems="flex-start">
|
{/* <Flex flexDirection="column" alignItems="flex-start">
|
||||||
<Heading color={rawEarningsBalance.eq(0) ? 'textDisabled' : 'text'}>{displayBalance}</Heading>
|
<Heading color={rawEarningsBalance.eq(0) ? 'textDisabled' : 'text'}>{displayBalance}</Heading>
|
||||||
{earningsBusd > 0 && (
|
{earningsBusd > 0 && (
|
||||||
<Balance fontSize="12px" color="textSubtle" decimals={2} value={earningsBusd} unit=" USD" prefix="~" />
|
<Balance fontSize="12px" color="textSubtle" decimals={2} value={earningsBusd} unit=" USD" prefix="~" />
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex> */}
|
||||||
<Button
|
<Button
|
||||||
|
width="100%"
|
||||||
disabled={rawEarningsBalance.eq(0) || pendingTx}
|
disabled={rawEarningsBalance.eq(0) || pendingTx}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setPendingTx(true)
|
setPendingTx(true)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import { useBoardsFromPid } from 'state/hooks'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import DepositModal from '../DepositModal'
|
import DepositModal from '../DepositModal'
|
||||||
|
import AffirmModal from '../AffirmModal'
|
||||||
|
|
||||||
import useStakeBoard from '../../hooks/useStakeBoard'
|
import useStakeBoard from '../../hooks/useStakeBoard'
|
||||||
import useUnstakeBoard, { useUnstakeForceBoard } from '../../hooks/useUnstakeBoard'
|
import useUnstakeBoard, { useUnstakeForceBoard } from '../../hooks/useUnstakeBoard'
|
||||||
import WithdrawModal from '../WithdrawModal'
|
import WithdrawModal from '../WithdrawModal'
|
||||||
|
|
@ -22,13 +24,13 @@ interface NodeCardActionsProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const IconButtonWrapper = styled.div`
|
const IconButtonWrapper = styled.div`
|
||||||
display: flex;
|
width: 100%;
|
||||||
svg {
|
svg {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
const IconButtonDiv = styled(IconButton)`
|
const IconButtonDiv = styled(IconButton)`
|
||||||
width: auto;
|
width: 100%;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
@ -53,9 +55,11 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
tokenName={tokenName}
|
tokenName={tokenName}
|
||||||
/>,
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const [onPresentWithdraw] = useModal(
|
const [onPresentWithdraw] = useModal(
|
||||||
<WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />,
|
<WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />,
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleUnstake = () => {
|
const handleUnstake = () => {
|
||||||
const unlockTime = userData.unlockTime * 1000
|
const unlockTime = userData.unlockTime * 1000
|
||||||
if (unlockTime > new Date().getTime()) {
|
if (unlockTime > new Date().getTime()) {
|
||||||
|
|
@ -64,13 +68,28 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
onUnstake()
|
onUnstake()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const [onPresentAffirm] = useModal(
|
||||||
|
<AffirmModal
|
||||||
|
title={
|
||||||
|
board.pid === 1
|
||||||
|
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
||||||
|
? t('Cancel the pledge')
|
||||||
|
: t('Forced to cancel')
|
||||||
|
: t('Cancel the pledge')
|
||||||
|
}
|
||||||
|
handSubmit={handleUnstake}
|
||||||
|
/>,
|
||||||
|
)
|
||||||
const renderStakingButtons = () => {
|
const renderStakingButtons = () => {
|
||||||
return rawStakedBalance === 0 ? (
|
return rawStakedBalance === 0 ? (
|
||||||
<Button onClick={onPresentDeposit}>{t(`pledge`)}</Button>
|
<Button width="100%" onClick={onPresentDeposit}>
|
||||||
|
{t(`pledge`)}
|
||||||
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<IconButtonWrapper>
|
<IconButtonWrapper>
|
||||||
{userData.stakedBalance > 0 ? (
|
{userData.stakedBalance > 0 ? (
|
||||||
<IconButtonDiv variant="tertiary" onClick={handleUnstake}>
|
// <IconButtonDiv variant="tertiary" onClick={handleUnstake}>
|
||||||
|
<IconButtonDiv variant="tertiary" onClick={onPresentAffirm}>
|
||||||
{board.pid === 1
|
{board.pid === 1
|
||||||
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
||||||
? t('Cancel the pledge')
|
? t('Cancel the pledge')
|
||||||
|
|
@ -79,7 +98,7 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
</IconButtonDiv>
|
</IconButtonDiv>
|
||||||
) : (
|
) : (
|
||||||
<IconButton variant="tertiary" onClick={onPresentDeposit} ml="6px">
|
<IconButton variant="tertiary" onClick={onPresentDeposit} ml="6px">
|
||||||
<AddIcon color="primary" />2
|
<AddIcon color="primary" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
</IconButtonWrapper>
|
</IconButtonWrapper>
|
||||||
|
|
@ -87,8 +106,8 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex justifyContent="space-between" alignItems="center">
|
<Flex justifyContent="space-between" alignItems="center" marginTop="20px">
|
||||||
<Heading color={rawStakedBalance === 0 ? 'textDisabled' : 'text'}>{rawStakedBalance}</Heading>
|
{/* <Heading color={rawStakedBalance === 0 ? 'textDisabled' : 'text'}>{rawStakedBalance}</Heading> */}
|
||||||
{renderStakingButtons()}
|
{renderStakingButtons()}
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
tokenName = '',
|
tokenName = '',
|
||||||
addLiquidityUrl,
|
addLiquidityUrl,
|
||||||
}) => {
|
}) => {
|
||||||
|
const regNumber = /^\d+(\.\d+)?$/
|
||||||
const { toastSuccess, toastError, toastWarning } = useToast()
|
const { toastSuccess, toastError, toastWarning } = useToast()
|
||||||
const [val, setVal] = useState('')
|
const [val, setVal] = useState('')
|
||||||
const [pendingTx, setPendingTx] = useState(false)
|
const [pendingTx, setPendingTx] = useState(false)
|
||||||
|
|
@ -63,14 +64,22 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
width="100%"
|
width="100%"
|
||||||
disabled={pendingTx || fullBalance === '0' || val === '0'}
|
disabled={pendingTx || fullBalance === '0' || val === '0'}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
if (!regNumber.test(val)) {
|
||||||
|
toastWarning(t('Please enter a number'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (Number(val) > Number(fullBalance)) {
|
||||||
|
toastWarning(t('Insufficient Balance'))
|
||||||
|
return
|
||||||
|
}
|
||||||
if (Number(val) < min.toNumber()) {
|
if (Number(val) < min.toNumber()) {
|
||||||
toastWarning(t('Hint'), `${t('At least stake ')}${min.toNumber()}`)
|
toastWarning(`${t('Minimum amount pledged')}${min.toNumber()}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setPendingTx(true)
|
setPendingTx(true)
|
||||||
try {
|
try {
|
||||||
await onConfirm(val)
|
await onConfirm(val)
|
||||||
toastSuccess(t('Staked!'), t('Your funds have been staked in the farm'))
|
toastSuccess(t('Staked!'))
|
||||||
onDismiss()
|
onDismiss()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toastError(
|
toastError(
|
||||||
|
|
@ -86,9 +95,9 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
{pendingTx ? t('Pending Confirmation') : t('Confirm')}
|
{pendingTx ? t('Pending Confirmation') : t('Confirm')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalActions>
|
</ModalActions>
|
||||||
<LinkExternal href={addLiquidityUrl} style={{ alignSelf: 'center' }}>
|
{/* <LinkExternal href={addLiquidityUrl} style={{ alignSelf: 'center' }}>
|
||||||
{t('Get %symbol%', { symbol: tokenName })}
|
{t('Get %symbol%', { symbol: tokenName })}
|
||||||
</LinkExternal>
|
</LinkExternal> */}
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ import { useTranslation } from 'contexts/Localization'
|
||||||
import BoardCard from './components/BoardCard/BoardCard'
|
import BoardCard from './components/BoardCard/BoardCard'
|
||||||
import HeaderItem from './components/HeaderItem'
|
import HeaderItem from './components/HeaderItem'
|
||||||
|
|
||||||
|
const PageContent = styled.div`
|
||||||
|
background-image: url('/images/recommend/bg.svg');
|
||||||
|
`
|
||||||
|
|
||||||
const Header = styled.div`
|
const Header = styled.div`
|
||||||
padding: 32px 0px;
|
padding: 32px 0px;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
|
|
@ -77,7 +81,7 @@ const Boards: React.FC = () => {
|
||||||
return {
|
return {
|
||||||
pid: boardConfig.pid,
|
pid: boardConfig.pid,
|
||||||
curAmount: getBalanceAmount(new BigNumber(boardPoolInfo.curAmount._hex)).toNumber(),
|
curAmount: getBalanceAmount(new BigNumber(boardPoolInfo.curAmount._hex)).toNumber(),
|
||||||
// totalAmount: getBalanceAmount(new BigNumber(boardPoolInfo.totalAmount._hex)).toNumber(),
|
receiveReward: boardsList.filter((n) => boardConfig.pid === n.pid),
|
||||||
holderNum: new BigNumber(boardPoolInfo?.holderNum?._hex).toNumber(),
|
holderNum: new BigNumber(boardPoolInfo?.holderNum?._hex).toNumber(),
|
||||||
waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(),
|
waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(),
|
||||||
totalReward: getBalanceAmount(new BigNumber(boardPoolInfo?.totalReward?._hex)).toNumber(),
|
totalReward: getBalanceAmount(new BigNumber(boardPoolInfo?.totalReward?._hex)).toNumber(),
|
||||||
|
|
@ -89,6 +93,7 @@ const Boards: React.FC = () => {
|
||||||
let waitWithdrawAmountValue = 0
|
let waitWithdrawAmountValue = 0
|
||||||
let totalReward = 0
|
let totalReward = 0
|
||||||
boardsData.forEach((item) => {
|
boardsData.forEach((item) => {
|
||||||
|
console.log(item)
|
||||||
total += item.curAmount
|
total += item.curAmount
|
||||||
totalReward += item.totalReward
|
totalReward += item.totalReward
|
||||||
waitWithdrawAmountValue += item.waitWithdrawAmount
|
waitWithdrawAmountValue += item.waitWithdrawAmount
|
||||||
|
|
@ -115,7 +120,7 @@ const Boards: React.FC = () => {
|
||||||
<div>
|
<div>
|
||||||
<FlexLayout>
|
<FlexLayout>
|
||||||
{boardsList.map((board, index) => (
|
{boardsList.map((board, index) => (
|
||||||
<BoardCard boardsData={boardsDataList[index]} key={board.pid} board={board} account={account} removed />
|
<BoardCard boardsData={boardsDataList[index]} key={board.pid} board={board} accountData={account} removed />
|
||||||
))}
|
))}
|
||||||
</FlexLayout>
|
</FlexLayout>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -123,6 +128,7 @@ const Boards: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<PageContent>
|
||||||
<Page>
|
<Page>
|
||||||
<Header>
|
<Header>
|
||||||
<Heading as="h1" size="xl" color="text" mb="10px" mt="10px">
|
<Heading as="h1" size="xl" color="text" mb="10px" mt="10px">
|
||||||
|
|
@ -138,6 +144,7 @@ const Boards: React.FC = () => {
|
||||||
</Header>
|
</Header>
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
</Page>
|
</Page>
|
||||||
|
</PageContent>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ const FristCom: React.FC = () => {
|
||||||
externalLinkList: [],
|
externalLinkList: [],
|
||||||
userCount: '',
|
userCount: '',
|
||||||
volume: '',
|
volume: '',
|
||||||
|
market: 0,
|
||||||
})
|
})
|
||||||
const [linkList, setLinkList] = useState([])
|
const [linkList, setLinkList] = useState([])
|
||||||
|
|
||||||
|
|
@ -198,7 +199,7 @@ const FristCom: React.FC = () => {
|
||||||
<ScoreDiv>
|
<ScoreDiv>
|
||||||
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userCount} />
|
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userCount} />
|
||||||
<FlexItemCom name={t('Your volume')} valueNum={detail?.volume} />
|
<FlexItemCom name={t('Your volume')} valueNum={detail?.volume} />
|
||||||
<FlexItemCom name={t('market value')} valueNum={0} />
|
<FlexItemCom name={t('market value')} valueNum={detail?.market} />
|
||||||
{/* {burned.map((item) => {
|
{/* {burned.map((item) => {
|
||||||
return <FlexItemCom key={item.id} name={item.name} value={item.value} />
|
return <FlexItemCom key={item.id} name={item.name} value={item.value} />
|
||||||
})} */}
|
})} */}
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,22 @@ const FooterBtn = styled.div`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ContentDiv = styled.div`
|
const ContentDiv = styled.div`
|
||||||
width: 60%;
|
width: 75%;
|
||||||
background: rgba(255, 255, 255, 0.39);
|
background: rgba(255, 255, 255, 0.39);
|
||||||
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
||||||
border-radius: 40px;
|
border-radius: 40px;
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.sm} {
|
${({ theme }) => theme.mediaQueries.sm} {
|
||||||
width: 60%;
|
width: 75%;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
width: 75%;
|
||||||
|
/* height: 80vh; */
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.lg} {
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
width: 60%;
|
width: 50%;
|
||||||
}
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
|
||||||
width: 90%;
|
|
||||||
height: 80vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ const FooterDiv = styled.div`
|
||||||
margin: 0 auto 30px auto;
|
margin: 0 auto 30px auto;
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
`
|
`
|
||||||
const TextDiv = styled(Text)`
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
`
|
|
||||||
|
|
||||||
const UnunitedCom: React.FC = () => {
|
const UnunitedCom: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,12 @@ const ContentDiv = styled.div`
|
||||||
background: rgba(255, 255, 255, 0.39);
|
background: rgba(255, 255, 255, 0.39);
|
||||||
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
||||||
border-radius: 40px;
|
border-radius: 40px;
|
||||||
|
`
|
||||||
/* ${({ theme }) => theme.mediaQueries.sm} {
|
const ContentUnunited = styled.div`
|
||||||
width: 60%;
|
width: 30%;
|
||||||
}
|
background: rgba(255, 255, 255, 0.39);
|
||||||
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
||||||
${({ theme }) => theme.mediaQueries.lg} {
|
border-radius: 40px;
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
|
||||||
width: 60%;
|
|
||||||
} */
|
|
||||||
`
|
`
|
||||||
|
|
||||||
const Nft: React.FC = () => {
|
const Nft: React.FC = () => {
|
||||||
|
|
@ -47,19 +42,42 @@ const Nft: React.FC = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainDiv>
|
<MainDiv>
|
||||||
{referralIsCommander ? (
|
{account ? (
|
||||||
|
referralIsCommander ? (
|
||||||
|
<RegimentalCom />
|
||||||
|
) : (
|
||||||
|
<ContentDiv>
|
||||||
|
<ConnectedCom />
|
||||||
|
</ContentDiv>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<ContentUnunited>
|
||||||
|
<UnunitedCom />
|
||||||
|
</ContentUnunited>
|
||||||
|
)}
|
||||||
|
{/* {referralIsCommander ? (
|
||||||
<>
|
<>
|
||||||
{account ? (
|
{account ? (
|
||||||
<RegimentalCom />
|
<RegimentalCom />
|
||||||
) : (
|
) : (
|
||||||
<ContentDiv>
|
<ContentUnunited>
|
||||||
<UnunitedCom />
|
<UnunitedCom />
|
||||||
</ContentDiv>
|
</ContentUnunited>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ContentDiv>{account ? <ConnectedCom /> : <UnunitedCom />}</ContentDiv>
|
<>
|
||||||
|
{account ? (
|
||||||
|
<ContentDiv>
|
||||||
|
<ConnectedCom />
|
||||||
|
</ContentDiv>
|
||||||
|
) : (
|
||||||
|
<ContentUnunited>
|
||||||
|
<UnunitedCom />
|
||||||
|
</ContentUnunited>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)} */}
|
||||||
</MainDiv>
|
</MainDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue