diff --git a/build.zip b/build.zip new file mode 100644 index 0000000..8640e89 Binary files /dev/null and b/build.zip differ diff --git a/public/images/home/logo.svg b/public/images/home/logo.svg index f73f140..362a665 100644 --- a/public/images/home/logo.svg +++ b/public/images/home/logo.svg @@ -1,3 +1,10 @@ - - + + + + + diff --git a/public/locales/zh-CN.json b/public/locales/zh-CN.json index 4d3dc63..69f1781 100644 --- a/public/locales/zh-CN.json +++ b/public/locales/zh-CN.json @@ -116,7 +116,7 @@ "Total jackpot this round": "此回合的总累积奖池", "Collect Winnings": "收集奖金", "Buy Tickets": "购买彩票", - "Harvest": "收割", + "Harvest": "领取收益", "Approve": "批准", "Select": "选择", "Winning Numbers This Round": "此回合的中奖号码", @@ -1131,5 +1131,12 @@ "top": "置顶", "Cancel the pledge": "取消质押", "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": "请输入数字" } diff --git a/src/config/constants/contracts.ts b/src/config/constants/contracts.ts index 4521a28..33a4039 100644 --- a/src/config/constants/contracts.ts +++ b/src/config/constants/contracts.ts @@ -8,7 +8,7 @@ export default { 56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95', }, boardChef: { - 97: '0x733240108a3626f6f4871328f168281040655d08', + 97: '0xe477990fc68d93472e2cc4b1aae21fe30f602c9a', 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约 }, boardRewardChef: { diff --git a/src/config/localization/translations.json b/src/config/localization/translations.json index e419af2..d8909bd 100644 --- a/src/config/localization/translations.json +++ b/src/config/localization/translations.json @@ -1258,5 +1258,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" + "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" } diff --git a/src/state/types.ts b/src/state/types.ts index efefbc2..c99d491 100644 --- a/src/state/types.ts +++ b/src/state/types.ts @@ -503,6 +503,7 @@ export interface Boards extends BoardConfig { stakedBalance: number unlockTime: number estimatedProfit: number + receiveReward: number } } export interface BoardsState { diff --git a/src/views/Board/components/AffirmModal.tsx b/src/views/Board/components/AffirmModal.tsx new file mode 100644 index 0000000..bb29aba --- /dev/null +++ b/src/views/Board/components/AffirmModal.tsx @@ -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 = ({ title, content, onDismiss, handSubmit }) => { + const { t } = useTranslation() + const submit = async () => { + await handSubmit() + onDismiss() + } + return ( + + {!content ? t('Whether to cancel') : content} + + + + + + ) +} + +export default DepositModal diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index 395028b..af2d537 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -88,16 +88,21 @@ const CardDiv = styled.div` const ContentDiv = styled.div` padding: 0 20px; ` +const InfoDiv = styled(Flex)` + flex-direction: column; + height: 60px; + justify-content: space-between; +` interface NodeCardProps { board: any removed: boolean provider?: ProviderType - account?: string + accountData?: string boardsData?: any } -const BoardCard: React.FC = ({ board, account, boardsData }) => { +const BoardCard: React.FC = ({ board, accountData, boardsData }) => { const { t } = useTranslation() const [countDown, setCountDown] = useState('') useEffect(() => { @@ -137,15 +142,14 @@ const BoardCard: React.FC = ({ board, account, boardsData }) => { amount={board.userData?.amount} /> - {account && ( -
+ {accountData && ( + {board.pid === 1 && board.userData?.amount ? : ''} - {/* */} -
+ )} - + {/* = ({ board, account }) => { +const CardActions: React.FC = ({ board, accountData }) => { const { t } = useTranslation() const [requestedApproval, setRequestedApproval] = useState(false) const pid = board.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 { 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 () => { try { setRequestedApproval(true) @@ -44,34 +59,54 @@ const CardActions: React.FC = ({ board, account }) => { console.error(e) } }, [onApprove]) + const [totalPrice, setTotalPrice] = useState(0) + useMemo(() => { + setTotalPrice(getBalanceAmount(new BigNumber(board?.userData?.receiveReward)).toNumber() + Number(displayBalance)) + }, [board]) const renderApprovalOrStakeButton = () => { return isApproved ? ( <> - + + + + {t('Unclaimed income')} + + + + {displayBalance} + + + {(Number(hccPriceUsdt.toNumber().toFixed(3)) * Number(displayBalance)).toFixed(3)} USDT + + + + {/* */} + {/* {board.tokenSymbol} {t('Staked')} - + */} + - - + {/* */} + {/* {t('Unclaimed income')} - - - + */} + {/* */} + {/* */} ) : ( ) } - return {!account ? : renderApprovalOrStakeButton()} + return {!accountData ? : renderApprovalOrStakeButton()} } export default CardActions diff --git a/src/views/Board/components/BoardCard/CardHeading.tsx b/src/views/Board/components/BoardCard/CardHeading.tsx index a3e1f38..10f820c 100644 --- a/src/views/Board/components/BoardCard/CardHeading.tsx +++ b/src/views/Board/components/BoardCard/CardHeading.tsx @@ -77,7 +77,7 @@ const CardHeading: React.FC = ({ name, img, tokenSymbol, {/* */} - {name} + {t(`${name}`)} {/* */} {amount > 0 && account && ( diff --git a/src/views/Board/components/BoardCard/HarvestAction.tsx b/src/views/Board/components/BoardCard/HarvestAction.tsx index 4bd79e6..015bd90 100644 --- a/src/views/Board/components/BoardCard/HarvestAction.tsx +++ b/src/views/Board/components/BoardCard/HarvestAction.tsx @@ -31,14 +31,15 @@ const HarvestAction: React.FC = ({ earnings, pid }) => { const earningsBusd = rawEarningsBalance ? rawEarningsBalance.multipliedBy(cakePrice).toNumber() : 0 return ( - - + + {/* {displayBalance} {earningsBusd > 0 && ( )} - + */} + ) : ( {userData.stakedBalance > 0 ? ( - + // + {board.pid === 1 ? board.userData?.unlockTime * 1000 <= new Date().getTime() ? t('Cancel the pledge') @@ -79,7 +98,7 @@ const StakeAction: React.FC = ({ stakedBalance, tokenBalan ) : ( - 2 + )} @@ -87,8 +106,8 @@ const StakeAction: React.FC = ({ stakedBalance, tokenBalan } return ( - - {rawStakedBalance} + + {/* {rawStakedBalance} */} {renderStakingButtons()} ) diff --git a/src/views/Board/components/DepositModal.tsx b/src/views/Board/components/DepositModal.tsx index cb9c22b..d9c2ad5 100644 --- a/src/views/Board/components/DepositModal.tsx +++ b/src/views/Board/components/DepositModal.tsx @@ -25,6 +25,7 @@ const DepositModal: React.FC = ({ tokenName = '', addLiquidityUrl, }) => { + const regNumber = /^\d+(\.\d+)?$/ const { toastSuccess, toastError, toastWarning } = useToast() const [val, setVal] = useState('') const [pendingTx, setPendingTx] = useState(false) @@ -63,14 +64,22 @@ const DepositModal: React.FC = ({ width="100%" disabled={pendingTx || fullBalance === '0' || val === '0'} 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()) { - toastWarning(t('Hint'), `${t('At least stake ')}${min.toNumber()}`) + toastWarning(`${t('Minimum amount pledged')}${min.toNumber()}`) return } setPendingTx(true) try { await onConfirm(val) - toastSuccess(t('Staked!'), t('Your funds have been staked in the farm')) + toastSuccess(t('Staked!')) onDismiss() } catch (e) { toastError( @@ -86,9 +95,9 @@ const DepositModal: React.FC = ({ {pendingTx ? t('Pending Confirmation') : t('Confirm')} - + {/* {t('Get %symbol%', { symbol: tokenName })} - + */} ) } diff --git a/src/views/Board/index.tsx b/src/views/Board/index.tsx index 35becca..b3bef64 100644 --- a/src/views/Board/index.tsx +++ b/src/views/Board/index.tsx @@ -23,6 +23,10 @@ import { useTranslation } from 'contexts/Localization' import BoardCard from './components/BoardCard/BoardCard' import HeaderItem from './components/HeaderItem' +const PageContent = styled.div` + background-image: url('/images/recommend/bg.svg'); +` + const Header = styled.div` padding: 32px 0px; padding-left: 16px; @@ -77,7 +81,7 @@ const Boards: React.FC = () => { return { pid: boardConfig.pid, 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(), waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(), totalReward: getBalanceAmount(new BigNumber(boardPoolInfo?.totalReward?._hex)).toNumber(), @@ -89,6 +93,7 @@ const Boards: React.FC = () => { let waitWithdrawAmountValue = 0 let totalReward = 0 boardsData.forEach((item) => { + console.log(item) total += item.curAmount totalReward += item.totalReward waitWithdrawAmountValue += item.waitWithdrawAmount @@ -115,7 +120,7 @@ const Boards: React.FC = () => {
{boardsList.map((board, index) => ( - + ))}
@@ -123,21 +128,23 @@ const Boards: React.FC = () => { } return ( - -
- - {t('Total capital pool')} - - - - - {/* */} - - - -
- {renderContent()} -
+ + +
+ + {t('Total capital pool')} + + + + + {/* */} + + + +
+ {renderContent()} +
+
) } diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index ac8703d..5578556 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -137,6 +137,7 @@ const FristCom: React.FC = () => { externalLinkList: [], userCount: '', volume: '', + market: 0, }) const [linkList, setLinkList] = useState([]) @@ -198,7 +199,7 @@ const FristCom: React.FC = () => { - + {/* {burned.map((item) => { return })} */} diff --git a/src/views/Referral/components/Regimental.tsx b/src/views/Referral/components/Regimental.tsx index 91d7650..5bc3da5 100644 --- a/src/views/Referral/components/Regimental.tsx +++ b/src/views/Referral/components/Regimental.tsx @@ -38,22 +38,22 @@ const FooterBtn = styled.div` ` const ContentDiv = styled.div` - width: 60%; + width: 75%; background: rgba(255, 255, 255, 0.39); box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16); border-radius: 40px; ${({ theme }) => theme.mediaQueries.sm} { - width: 60%; + width: 75%; + } + ${({ theme }) => theme.mediaQueries.xs} { + width: 75%; + /* height: 80vh; */ + overflow-y: auto; } ${({ theme }) => theme.mediaQueries.lg} { - width: 60%; - } - ${({ theme }) => theme.mediaQueries.xs} { - width: 90%; - height: 80vh; - overflow-y: auto; + width: 50%; } ` diff --git a/src/views/Referral/components/UnunitedCom.tsx b/src/views/Referral/components/UnunitedCom.tsx index 7dd42e2..a089c23 100644 --- a/src/views/Referral/components/UnunitedCom.tsx +++ b/src/views/Referral/components/UnunitedCom.tsx @@ -18,10 +18,6 @@ const FooterDiv = styled.div` margin: 0 auto 30px auto; margin-left: 10%; ` -const TextDiv = styled(Text)` - margin-top: 10px; - font-size: 14px; -` const UnunitedCom: React.FC = () => { const { t } = useTranslation() diff --git a/src/views/Referral/index.tsx b/src/views/Referral/index.tsx index 4dca84c..5022079 100644 --- a/src/views/Referral/index.tsx +++ b/src/views/Referral/index.tsx @@ -23,17 +23,12 @@ const ContentDiv = styled.div` background: rgba(255, 255, 255, 0.39); box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16); border-radius: 40px; - - /* ${({ theme }) => theme.mediaQueries.sm} { - width: 60%; - } - - ${({ theme }) => theme.mediaQueries.lg} { - width: 60%; - } - ${({ theme }) => theme.mediaQueries.xs} { - width: 60%; - } */ +` +const ContentUnunited = styled.div` + width: 30%; + background: rgba(255, 255, 255, 0.39); + box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16); + border-radius: 40px; ` const Nft: React.FC = () => { @@ -47,19 +42,42 @@ const Nft: React.FC = () => { return ( - {referralIsCommander ? ( + {account ? ( + referralIsCommander ? ( + + ) : ( + + + + ) + ) : ( + + + + )} + {/* {referralIsCommander ? ( <> {account ? ( ) : ( - + - + )} ) : ( - {account ? : } - )} + <> + {account ? ( + + + + ) : ( + + + + )} + + )} */} ) }