Merge pull request #34510 from akhileshh/master

fix: Fixes  api word capitalization freeCodeCamp
This commit is contained in:
Akhilesh Halageri
2018-12-03 01:56:18 -08:00
committed by Stuart Taylor
parent d9ac45868c
commit ed5b434ad1
3 changed files with 8 additions and 8 deletions

View File

@ -9,6 +9,7 @@ import ga from '../../../analytics';
import { makeExpandedBlockSelector, toggleBlock } from '../redux';
import { userSelector } from '../../../redux';
import Caret from '../../icons/Caret';
import { blockNameify } from '../../../../utils/blockNameify';
/* eslint-disable max-len */
import GreenPass from '../../../templates/Challenges/components/icons/GreenPass';
import GreenNotCompleted from '../../../templates/Challenges/components/icons/GreenNotCompleted';
@ -108,8 +109,7 @@ export class Block extends Component {
}
render() {
const { completedChallenges, challenges, isExpanded, intro } = this.props;
const { blockName } = challenges[0].fields;
const { blockDashedName, completedChallenges, challenges, isExpanded, intro } = this.props;
const challengesWithCompleted = challenges.map(challenge => {
const { id } = challenge;
const isCompleted = completedChallenges.some(
@ -121,7 +121,7 @@ export class Block extends Component {
<li className={`block ${isExpanded ? 'open' : ''}`}>
<div className='map-title' onClick={this.handleBlockClick}>
<Caret />
<h5>{blockName}</h5>
<h5>{blockNameify(blockDashedName)}</h5>
</div>
<ul>
{isExpanded

View File

@ -10,7 +10,9 @@ const preFormattedBlockNames = {
jquery: 'jQuery',
'json-apis-and-ajax': 'JSON APIs and Ajax',
'mongodb-and-mongoose': 'MongoDB and Mongoose',
'the-dom': 'The DOM'
'the-dom': 'The DOM',
'apis-and-microservices': 'APIs and Microservices',
'apis-and-microservices-projects': 'APIs and Microservices Projects'
};
const noFormatting = ['and', 'for', 'of', 'the', 'up', 'with'];

View File

@ -7,6 +7,7 @@ const {
} = require('../../curriculum/getChallenges');
const utils = require('./');
const { locale } = require('../config/env.json');
const { blockNameify } = require('./blockNameify');
const dasherize = utils.dasherize;
const nameify = utils.nameify;
@ -56,9 +57,6 @@ function prepareChallenge(challenge) {
);
}
challenge.block = dasherize(challenge.block);
challenge.superBlock = challenge.superBlock
.split('-')
.map(word => _.capitalize(word))
.join(' ');
challenge.superBlock = blockNameify(challenge.superBlock);
return challenge;
}