From 1a6eedb2291ce660b9ed690588dd6249dc46275f Mon Sep 17 00:00:00 2001
From: NguyenTheQuang <60279723+quangdz1704@users.noreply.github.com>
Date: Thu, 18 Jan 2024 11:27:22 +0700
Subject: [PATCH] Hotfix/cohavest bid (#554)
* fix: change update started status
---
.../CoHarvest/components/BiddingChart/index.tsx | 4 ++--
.../CoHarvest/components/InputBalance/index.tsx | 3 ++-
src/pages/CoHarvest/hooks/useCountdown.ts | 13 ++++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/pages/CoHarvest/components/BiddingChart/index.tsx b/src/pages/CoHarvest/components/BiddingChart/index.tsx
index 2bba2b2b9..c4bed1ad2 100644
--- a/src/pages/CoHarvest/components/BiddingChart/index.tsx
+++ b/src/pages/CoHarvest/components/BiddingChart/index.tsx
@@ -3,7 +3,7 @@ import { useCoinGeckoPrices } from 'hooks/useCoingecko';
import useConfigReducer from 'hooks/useConfigReducer';
import { getUsd } from 'libs/utils';
import { useGetAllBidPoolInRound } from 'pages/CoHarvest/hooks/useGetBidRound';
-import { formatDisplayUsdt } from 'pages/Pools/helpers';
+import { formatDisplayUsdt, numberWithCommas } from 'pages/Pools/helpers';
import { memo, useState } from 'react';
import ChartColumn from '../ChartColumn';
import { TooltipIconBtn } from '../Tooltip';
@@ -44,7 +44,7 @@ const BiddingChart = (props: { round: number; bidInfo }) => {
{formatDisplayUsdt(amountUsd)}
{'('}
-
{toDisplay(totalBidAmount)} ORAIX
+
{numberWithCommas(toDisplay(totalBidAmount))} ORAIX
{')'}
diff --git a/src/pages/CoHarvest/components/InputBalance/index.tsx b/src/pages/CoHarvest/components/InputBalance/index.tsx
index 3451d7153..0d49fa8ec 100644
--- a/src/pages/CoHarvest/components/InputBalance/index.tsx
+++ b/src/pages/CoHarvest/components/InputBalance/index.tsx
@@ -5,6 +5,7 @@ import styles from './index.module.scss';
import { toAmount, toDisplay } from '@oraichain/oraidex-common';
import { ORAIX_DECIMAL } from 'pages/CoHarvest/constants';
+import { numberWithCommas } from 'pages/Pools/helpers';
export type InputBalanceType = {
amount: string | number;
@@ -19,7 +20,7 @@ const InputBalance = ({ amount, onChangeAmount, disable = false, balance }: Inpu
return (
- Balance: {toDisplay(balance)} ORAIX
+ Balance: {numberWithCommas(toDisplay(balance))} ORAIX
{
const [timeRemaining, setTimeRemaining] = useState(() => calcDiffTime(getTimeDateNow, end));
const [isStarted, setIsStarted] = useState(() => {
const isStart = getTimeDateNow >= start;
-
- if (isStart) {
- onStart();
- }
return isStart;
});
@@ -34,8 +30,15 @@ export const useCountdown = ({ bidInfo, onStart, onEnd }: CountDownType) => {
if (!bidInfo.round) return;
setStart(bidInfo?.start_time);
setEnd(bidInfo?.end_time);
+ setIsStarted(() => {
+ const isStart = getTimeDateNow >= bidInfo?.start_time * TIMER.MILLISECOND;
+
+ if (isStart) {
+ onStart();
+ }
- setIsStarted(() => getTimeDateNow >= bidInfo?.start_time * TIMER.MILLISECOND);
+ return isStart;
+ });
setTimeRemaining(() => calcDiffTime(getTimeDateNow, bidInfo?.end_time * TIMER.MILLISECOND));
const decrementTime = () => {