fix: Handle goal reached 🎉

This commit is contained in:
Bouncey
2018-12-03 17:47:30 +00:00
committed by mrugesh mohapatra
parent 1fba44f722
commit 2e578a7af8

View File

@ -17,14 +17,24 @@ const supportersLocale = supporterGoal.toLocaleString();
function Supporters({ isDonating, activeDonations }) { function Supporters({ isDonating, activeDonations }) {
const donationsLocale = activeDonations.toLocaleString(); const donationsLocale = activeDonations.toLocaleString();
const isGoalReached = activeDonations >= supporterGoal;
return ( return (
<Fragment> <Fragment>
<FullWidthRow> <FullWidthRow>
<h2>Support an open future.</h2> <h2>Support an open future.</h2>
</FullWidthRow> </FullWidthRow>
{isGoalReached ? (
<FullWidthRow>
<Spacer />
<p>
🎉 {donationsLocale} supporters help keep freeCodeCamp.org free to
use
</p>
</FullWidthRow>
) : (
<FullWidthRow> <FullWidthRow>
<div id='supporter-progress-wrapper'> <div id='supporter-progress-wrapper'>
<ProgressBar max={10000} now={activeDonations} /> <ProgressBar max={supporterGoal} now={activeDonations} />
<div id='progress-label-wrapper'> <div id='progress-label-wrapper'>
<span className='progress-label'> <span className='progress-label'>
{donationsLocale} supporters out of {supportersLocale} supporter {donationsLocale} supporters out of {supportersLocale} supporter
@ -33,6 +43,7 @@ function Supporters({ isDonating, activeDonations }) {
</div> </div>
</div> </div>
</FullWidthRow> </FullWidthRow>
)}
<Spacer /> <Spacer />
<FullWidthRow> <FullWidthRow>
<b> <b>