fix: Display JS "Claim Certificate" button (#17104)

The "Claim Certificate" button for the "JavaScript Algorithms and Data
Structures" projects will now be visible when all projects have been
completed.
This commit is contained in:
Jake Magers
2018-05-14 01:37:47 -07:00
committed by Stuart Taylor
parent 26ec1a6ea7
commit 69d833da66

View File

@ -55,6 +55,10 @@ class JSAlgoAndDSForm extends PureComponent {
jsProjects = {},
isCertClaimed
} = this.props;
const completeCount = Object.values(jsProjects)
.filter(challengeInfo => Object.keys(challengeInfo).length !== 0)
.length;
return (
<FullWidthRow>
<h3 className='project-heading'>{ projectBlockName }</h3>
@ -100,7 +104,7 @@ class JSAlgoAndDSForm extends PureComponent {
}
</ul>
{
Object.keys(jsProjects).length === 6 ?
Object.keys(jsProjects).length === completeCount ?
<form onSubmit={ this.handleSubmit }>
<BlockSaveButton>
{ isCertClaimed ? 'Show' : 'Claim'} Certificate