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