调整锁仓时间

This commit is contained in:
myf 2022-05-09 17:29:10 +08:00
parent 6da370c2fc
commit 789e4602f4
5 changed files with 30 additions and 8 deletions

BIN
build.zip Normal file

Binary file not shown.

View File

@ -146,7 +146,7 @@ const Announcement: React.FC = () => {
const innerHeight = window.innerHeight const innerHeight = window.innerHeight
const screenH = Math.ceil(innerHeight + window.scrollY) const screenH = Math.ceil(innerHeight + window.scrollY)
const eleH = document.documentElement.offsetHeight const eleH = document.documentElement.offsetHeight
if (screenH >= eleH) { if (screenH >= eleH && list.length > 0) {
setPage(pageNum + 1) setPage(pageNum + 1)
} }
} }

View File

@ -1,4 +1,5 @@
import React, { useMemo, useState } from 'react' import React, { useMemo, useState, useEffect } from 'react'
import dayjs from 'dayjs'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import styled, { keyframes } from 'styled-components' import styled, { keyframes } from 'styled-components'
import { Flex, Text, Skeleton } from '@pancakeswap/uikit' import { Flex, Text, Skeleton } from '@pancakeswap/uikit'
@ -94,6 +95,29 @@ interface NodeCardProps {
const BoardCard: React.FC<NodeCardProps> = ({ board, account }) => { const BoardCard: React.FC<NodeCardProps> = ({ board, account }) => {
const { t } = useTranslation() const { t } = useTranslation()
const [countDown, setCountDown] = useState('')
useEffect(() => {
const interval = setInterval(() => {
if (board.userData?.unlockTime) {
const time = board.userData?.unlockTime * 1000
if (time > 0) {
countDownFun(time - 1)
}
}
}, 1000)
return () => clearInterval(interval)
}, [countDown, board])
const countDownFun = (date) => {
const date1 = dayjs()
const date2 = dayjs(date)
const time = date2.diff(date1)
const hour = Math.floor((time / (1000 * 60 * 60)) % 24)
const minute = Math.floor((time / (1000 * 60)) % 60)
const second = Math.round((time / 1000) % 60)
setCountDown(`${hour}:${minute}:${second}`)
}
const [showExpandableSection, setShowExpandableSection] = useState(false) const [showExpandableSection, setShowExpandableSection] = useState(false)
return ( return (
@ -103,11 +127,7 @@ const BoardCard: React.FC<NodeCardProps> = ({ board, account }) => {
<CardDiv> <CardDiv>
<div> <div>
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount} /> <FlexText name={t('HCC Currency amount')} value={board.userData?.amount} />
{board.userData?.name === 'Board' ? ( {board.userData?.name === 'Board' ? <FlexText name={t('Lock up time')} value={countDown} /> : ''}
<FlexText name={t('Lock up time')} value={board.userData?.unlockTime} />
) : (
''
)}
<FlexText name={t('possess LP')} value={board.userData?.rewardDebt} /> <FlexText name={t('possess LP')} value={board.userData?.rewardDebt} />
</div> </div>
<CardActionsContainer board={board} account={account} /> <CardActionsContainer board={board} account={account} />

View File

@ -69,6 +69,7 @@ const HeaderFlex = styled(Flex)``
const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol }) => { const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol }) => {
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
<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} /> */}
@ -77,7 +78,7 @@ const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol
{/* <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>
{/* <div className="ribbon"> {/* <div className="ribbon">
<div className="ribbon1"></div> <div className="ribbon1">{t('Staked')}</div>
</div> */} </div> */}
</Wrapper> </Wrapper>
) )

View File

@ -43,6 +43,7 @@ const FlexLayoutMain = styled(FlexLayout)`
const Boards: React.FC = () => { const Boards: React.FC = () => {
const { t } = useTranslation() const { t } = useTranslation()
const boardsList = useBoards() const boardsList = useBoards()
// console.log('boardsList', boardsList)
const account = useAccount() const account = useAccount()
const dispatch = useDispatch() const dispatch = useDispatch()