From a66b076771b4f1095286b649a988db9943ad3bf5 Mon Sep 17 00:00:00 2001 From: wraeth-eth <104132113+wraeth-eth@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:56:13 +1100 Subject: [PATCH] fix: show correct progress bar (#263) --- src/components/Project/components/Stats.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Project/components/Stats.tsx b/src/components/Project/components/Stats.tsx index 5b25ebb..c09294c 100644 --- a/src/components/Project/components/Stats.tsx +++ b/src/components/Project/components/Stats.tsx @@ -17,6 +17,7 @@ import { TooltipTrigger, } from '@/components/ui/Tooltip' import { JC01_DATES } from '@/lib/constants' +import { Ether } from 'juice-hooks' export type StatsProps = { className?: string @@ -34,7 +35,10 @@ export const Stats: React.FC = ({ className }) => { const progress = useMemo(() => { if (!softTarget.amount) return 100 - return Number((Number(totalRaised) / Number(softTarget.amount)) * 100) + if (!totalRaised) return 0 + const normalTarget = new Ether(softTarget.amount).toFloat() + const normalRaised = totalRaised.toFloat() + return Number(normalRaised / normalTarget) * 100 }, [totalRaised, softTarget]) return (