fix(client): fix v7 certlocation (#41565)

This commit is contained in:
Shaun Hamilton
2021-03-24 14:58:13 +00:00
committed by GitHub
parent 0fea83bac5
commit 3aad0808ed
2 changed files with 8 additions and 3 deletions

View File

@ -132,7 +132,7 @@ export class SuperBlockIntroductionPage extends Component {
const { const {
data: { data: {
markdownRemark: { markdownRemark: {
frontmatter: { superBlock } frontmatter: { superBlock, title }
}, },
allChallengeNode: { edges } allChallengeNode: { edges }
}, },
@ -175,7 +175,7 @@ export class SuperBlockIntroductionPage extends Component {
))} ))}
{superBlock !== 'coding-interview-prep' && ( {superBlock !== 'coding-interview-prep' && (
<div> <div>
<CertChallenge superBlock={superBlock} /> <CertChallenge superBlock={superBlock} title={title} />
</div> </div>
)} )}
</div> </div>
@ -216,6 +216,7 @@ export const query = graphql`
markdownRemark(fields: { slug: { eq: $slug } }) { markdownRemark(fields: { slug: { eq: $slug } }) {
frontmatter { frontmatter {
superBlock superBlock
title
} }
} }
allChallengeNode( allChallengeNode(

View File

@ -10,10 +10,12 @@ import GreenPass from '../../../assets/icons/GreenPass';
import GreenNotCompleted from '../../../assets/icons/GreenNotCompleted'; import GreenNotCompleted from '../../../assets/icons/GreenNotCompleted';
import { userSelector } from '../../../redux'; import { userSelector } from '../../../redux';
import { User } from '../../../redux/propTypes'; import { User } from '../../../redux/propTypes';
import { certMap } from '../../../resources/certAndProjectMap';
const propTypes = { const propTypes = {
superBlock: PropTypes.string, superBlock: PropTypes.string,
t: PropTypes.func, t: PropTypes.func,
title: PropTypes.string,
user: User user: User
}; };
@ -28,6 +30,7 @@ export class CertChallenge extends Component {
const { const {
superBlock, superBlock,
t, t,
title,
user: { user: {
is2018DataVisCert, is2018DataVisCert,
isApisMicroservicesCert, isApisMicroservicesCert,
@ -56,8 +59,9 @@ export class CertChallenge extends Component {
'machine-learning-with-python': isMachineLearningPyCertV7 'machine-learning-with-python': isMachineLearningPyCertV7
}; };
const cert = certMap.find(x => x.title === title);
const isCertified = userCertificates[superBlock]; const isCertified = userCertificates[superBlock];
const certLocation = `/certification/${username}/${superBlock}`; const certLocation = `/certification/${username}/${cert.slug}`;
const certCheckmarkStyle = { height: '40px', width: '40px' }; const certCheckmarkStyle = { height: '40px', width: '40px' };
const i18nSuperBlock = t(`intro:${superBlock}.title`); const i18nSuperBlock = t(`intro:${superBlock}.title`);
const i18nCertText = t(`intro:misc-text.certification`, { const i18nCertText = t(`intro:misc-text.certification`, {