diff --git a/build.zip b/build.zip new file mode 100644 index 0000000..c2a6689 Binary files /dev/null and b/build.zip differ diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index a7164ad..7e46c27 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -146,7 +146,7 @@ const Announcement: React.FC = () => { const innerHeight = window.innerHeight const screenH = Math.ceil(innerHeight + window.scrollY) const eleH = document.documentElement.offsetHeight - if (screenH >= eleH) { + if (screenH >= eleH && list.length > 0) { setPage(pageNum + 1) } } diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index 0cece1d..0c31be0 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -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 styled, { keyframes } from 'styled-components' import { Flex, Text, Skeleton } from '@pancakeswap/uikit' @@ -94,6 +95,29 @@ interface NodeCardProps { const BoardCard: React.FC = ({ board, account }) => { 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) return ( @@ -103,11 +127,7 @@ const BoardCard: React.FC = ({ board, account }) => {
- {board.userData?.name === 'Board' ? ( - - ) : ( - '' - )} + {board.userData?.name === 'Board' ? : ''}
diff --git a/src/views/Board/components/BoardCard/CardHeading.tsx b/src/views/Board/components/BoardCard/CardHeading.tsx index bf2639a..0843d7f 100644 --- a/src/views/Board/components/BoardCard/CardHeading.tsx +++ b/src/views/Board/components/BoardCard/CardHeading.tsx @@ -69,6 +69,7 @@ const HeaderFlex = styled(Flex)`` const CardHeading: React.FC = ({ name, img, tokenSymbol }) => { const { t } = useTranslation() + return ( {/* */} @@ -77,7 +78,7 @@ const CardHeading: React.FC = ({ name, img, tokenSymbol {/* */} {/*
-
已质押
+
{t('Staked')}
*/}
) diff --git a/src/views/Board/index.tsx b/src/views/Board/index.tsx index abbe8c2..4ea6d0c 100644 --- a/src/views/Board/index.tsx +++ b/src/views/Board/index.tsx @@ -43,6 +43,7 @@ const FlexLayoutMain = styled(FlexLayout)` const Boards: React.FC = () => { const { t } = useTranslation() const boardsList = useBoards() + // console.log('boardsList', boardsList) const account = useAccount() const dispatch = useDispatch()