diff --git a/client/gatsby-node.js b/client/gatsby-node.js index efdde019a0..eea4fe913d 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -20,9 +20,7 @@ exports.onCreateNode = function onCreateNode({ node, actions, getNode }) { const { createNodeField } = actions; if (node.internal.type === 'ChallengeNode') { const { tests = [], block, dashedName, superBlock } = node; - const slug = `/learn/${dasherize(superBlock)}/${dasherize( - block - )}/${dashedName}`; + const slug = `/learn/${superBlock}/${dasherize(block)}/${dashedName}`; createNodeField({ node, name: 'slug', value: slug }); createNodeField({ node, name: 'blockName', value: blockNameify(block) }); createNodeField({ node, name: 'tests', value: tests }); @@ -131,7 +129,7 @@ exports.createPages = function createPages({ graphql, actions, reporter }) { result.data.allChallengeNode.edges.map( ({ node: { superBlock } }) => superBlock ) - ).map(superBlock => blockNameify(superBlock)); + ); // Create intro pages result.data.allMarkdownRemark.edges.forEach(edge => { diff --git a/client/src/__mocks__/challenge-nodes.js b/client/src/__mocks__/challenge-nodes.js index bb7f5955b3..dc5ccd525f 100644 --- a/client/src/__mocks__/challenge-nodes.js +++ b/client/src/__mocks__/challenge-nodes.js @@ -8,7 +8,7 @@ export default [ block: 'block-a', title: 'Challenge One', isPrivate: false, - superBlock: 'Super Block One', + superBlock: 'super-block-one', dashedName: 'challenge-one' }, { @@ -20,7 +20,7 @@ export default [ block: 'block-a', title: 'Challenge Two', isPrivate: false, - superBlock: 'Super Block One', + superBlock: 'super-block-one', dashedName: 'challenge-two' }, { @@ -32,7 +32,7 @@ export default [ block: 'block-b', title: 'Challenge One', isPrivate: false, - superBlock: 'Super Block One', + superBlock: 'super-block-one', dashedName: 'challenge-one' }, { @@ -45,7 +45,7 @@ export default [ block: 'block-b', title: 'Challenge Two', isPrivate: false, - superBlock: 'Super Block One', + superBlock: 'super-block-one', dashedName: 'challenge-two' }, { @@ -57,7 +57,7 @@ export default [ block: 'block-c', title: 'Challenge One', isPrivate: true, - superBlock: 'Super Block One', + superBlock: 'super-block-one', dashedName: 'challenge-one' }, { @@ -69,7 +69,7 @@ export default [ block: 'block-a', title: 'Challenge One', isPrivate: false, - superBlock: 'Super Block Two', + superBlock: 'super-block-two', dashedName: 'challenge-one' }, { @@ -81,7 +81,7 @@ export default [ block: 'block-a', title: 'Challenge Two', isPrivate: false, - superBlock: 'Super Block Two', + superBlock: 'super-block-two', dashedName: 'challenge-two' }, { @@ -93,7 +93,7 @@ export default [ block: 'block-b', title: 'Challenge One', isPrivate: false, - superBlock: 'Super Block Two', + superBlock: 'super-block-two', dashedName: 'challenge-one' }, { @@ -105,7 +105,7 @@ export default [ block: 'block-b', title: 'Challenge Two', isPrivate: false, - superBlock: 'Super Block Two', + superBlock: 'super-block-two', dashedName: 'challenge-two' }, { @@ -117,7 +117,7 @@ export default [ block: 'block-a', title: 'Challenge One', isPrivate: false, - superBlock: 'Super Block Three', + superBlock: 'super-block-three', dashedName: 'challenge-one' }, { @@ -129,7 +129,7 @@ export default [ block: 'block-c', title: 'Challenge Two', isPrivate: false, - superBlock: 'Super Block Three', + superBlock: 'super-block-three', dashedName: 'challenge-two' } ]; diff --git a/client/src/assets/icons/index.js b/client/src/assets/icons/index.js index 83d5a41ae7..c8a1a5dd80 100644 --- a/client/src/assets/icons/index.js +++ b/client/src/assets/icons/index.js @@ -13,17 +13,17 @@ import Algorithm from './Algorithm'; const generateIconComponent = (superBlock, className) => { const iconMap = { - 'Responsive Web Design': ResponsiveDesign, - 'JavaScript Algorithms and Data Structures': JavaScriptIcon, - 'Front End Libraries': ReactIcon, - 'Data Visualization': D3Icon, - 'APIs and Microservices': APIIcon, - 'Quality Assurance': Clipboard, - 'Scientific Computing with Python': PythonIcon, - 'Data Analysis with Python': Analytics, - 'Information Security': Shield, - 'Machine Learning with Python': TensorflowIcon, - 'Coding Interview Prep': Algorithm + 'responsive-web-design': ResponsiveDesign, + 'javascript-algorithms-and-data-structures': JavaScriptIcon, + 'front-end-libraries': ReactIcon, + 'data-visualization': D3Icon, + 'apis-and-microservices': APIIcon, + 'quality-assurance': Clipboard, + 'scientific-computing-with-python': PythonIcon, + 'data-analysis-with-python': Analytics, + 'information-security': Shield, + 'machine-learning-with-python': TensorflowIcon, + 'coding-interview-prep': Algorithm }; // fallback in case super block doesn't exist and for tests const Icon = iconMap[superBlock] ? iconMap[superBlock] : ResponsiveDesign; diff --git a/client/src/components/Map/index.js b/client/src/components/Map/index.js index 03b88d719d..d635188f13 100644 --- a/client/src/components/Map/index.js +++ b/client/src/components/Map/index.js @@ -6,7 +6,6 @@ import { generateIconComponent } from '../../assets/icons'; import { Link, Spacer } from '../helpers'; import LinkButton from '../../assets/icons/LinkButton'; -import { dasherize } from '../../../../utils/slugs'; import './map.css'; import { isAuditedCert } from '../../../../utils/is-audited'; import { curriculumLocale } from '../../../../config/env.json'; @@ -16,11 +15,9 @@ const propTypes = { forLanding: PropTypes.bool }; -const codingPrepRE = new RegExp('Interview Prep'); - -function createSuperBlockTitle(str) { - const superBlockTitle = i18next.t(`intro:${dasherize(str)}.title`); - return codingPrepRE.test(str) +function createSuperBlockTitle(superBlock) { + const superBlockTitle = i18next.t(`intro:${superBlock}.title`); + return superBlock === 'coding-interview-prep' ? i18next.t('learn.cert-map-estimates.coding-prep', { title: superBlockTitle }) @@ -34,18 +31,18 @@ const linkSpacingStyle = { }; function renderLandingMap(nodes) { - nodes = nodes.filter(node => node.superBlock !== 'Coding Interview Prep'); + nodes = nodes.filter(node => node.superBlock !== 'coding-interview-prep'); return (