diff --git a/public/locales/zh-CN.json b/public/locales/zh-CN.json index b44c3b8..4d3dc63 100644 --- a/public/locales/zh-CN.json +++ b/public/locales/zh-CN.json @@ -1130,5 +1130,6 @@ "Invite": "邀请", "top": "置顶", "Cancel the pledge": "取消质押", - "Forced to cancel": "强制取消质押" + "Forced to cancel": "强制取消质押", + "End of the lock up": "锁仓结束" } diff --git a/src/config/localization/translations.json b/src/config/localization/translations.json index 35266b0..e419af2 100644 --- a/src/config/localization/translations.json +++ b/src/config/localization/translations.json @@ -1257,5 +1257,6 @@ "pledge": "pledge", "top": "top", "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" } diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index 9849e46..395028b 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -103,10 +103,11 @@ const BoardCard: React.FC = ({ board, account, boardsData }) => { useEffect(() => { const interval = setInterval(() => { if (board.userData?.unlockTime) { - const time = board.userData?.unlockTime * 1000 - if (time > 0) { - countDownFun(time - 1) + if (countDown === t('End of the lock up')) { + clearInterval(interval) } + const time = board.userData?.unlockTime * 1000 + countDownFun(time - 1) } }, 1000) return () => clearInterval(interval) @@ -116,10 +117,14 @@ const BoardCard: React.FC = ({ board, account, boardsData }) => { 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}`) + if (time > 0) { + 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}`) + } else { + setCountDown(`${t('End of the lock up')}`) + } } const [showExpandableSection, setShowExpandableSection] = useState(false)