Skip to content

Commit

Permalink
fix: show correct progress bar (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth authored Dec 7, 2023
1 parent b44dbdd commit a66b076
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Project/components/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +35,10 @@ export const Stats: React.FC<StatsProps> = ({ 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 (
Expand Down

1 comment on commit a66b076

@vercel
Copy link

@vercel vercel bot commented on a66b076 Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.