Merge pull request #34510 from akhileshh/master
fix: Fixes api word capitalization freeCodeCamp
This commit is contained in:
committed by
Stuart Taylor
parent
d9ac45868c
commit
ed5b434ad1
@ -9,6 +9,7 @@ import ga from '../../../analytics';
|
|||||||
import { makeExpandedBlockSelector, toggleBlock } from '../redux';
|
import { makeExpandedBlockSelector, toggleBlock } from '../redux';
|
||||||
import { userSelector } from '../../../redux';
|
import { userSelector } from '../../../redux';
|
||||||
import Caret from '../../icons/Caret';
|
import Caret from '../../icons/Caret';
|
||||||
|
import { blockNameify } from '../../../../utils/blockNameify';
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import GreenPass from '../../../templates/Challenges/components/icons/GreenPass';
|
import GreenPass from '../../../templates/Challenges/components/icons/GreenPass';
|
||||||
import GreenNotCompleted from '../../../templates/Challenges/components/icons/GreenNotCompleted';
|
import GreenNotCompleted from '../../../templates/Challenges/components/icons/GreenNotCompleted';
|
||||||
@ -108,8 +109,7 @@ export class Block extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { completedChallenges, challenges, isExpanded, intro } = this.props;
|
const { blockDashedName, completedChallenges, challenges, isExpanded, intro } = this.props;
|
||||||
const { blockName } = challenges[0].fields;
|
|
||||||
const challengesWithCompleted = challenges.map(challenge => {
|
const challengesWithCompleted = challenges.map(challenge => {
|
||||||
const { id } = challenge;
|
const { id } = challenge;
|
||||||
const isCompleted = completedChallenges.some(
|
const isCompleted = completedChallenges.some(
|
||||||
@ -121,7 +121,7 @@ export class Block extends Component {
|
|||||||
<li className={`block ${isExpanded ? 'open' : ''}`}>
|
<li className={`block ${isExpanded ? 'open' : ''}`}>
|
||||||
<div className='map-title' onClick={this.handleBlockClick}>
|
<div className='map-title' onClick={this.handleBlockClick}>
|
||||||
<Caret />
|
<Caret />
|
||||||
<h5>{blockName}</h5>
|
<h5>{blockNameify(blockDashedName)}</h5>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{isExpanded
|
{isExpanded
|
||||||
|
@ -10,7 +10,9 @@ const preFormattedBlockNames = {
|
|||||||
jquery: 'jQuery',
|
jquery: 'jQuery',
|
||||||
'json-apis-and-ajax': 'JSON APIs and Ajax',
|
'json-apis-and-ajax': 'JSON APIs and Ajax',
|
||||||
'mongodb-and-mongoose': 'MongoDB and Mongoose',
|
'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'];
|
const noFormatting = ['and', 'for', 'of', 'the', 'up', 'with'];
|
||||||
|
@ -7,6 +7,7 @@ const {
|
|||||||
} = require('../../curriculum/getChallenges');
|
} = require('../../curriculum/getChallenges');
|
||||||
const utils = require('./');
|
const utils = require('./');
|
||||||
const { locale } = require('../config/env.json');
|
const { locale } = require('../config/env.json');
|
||||||
|
const { blockNameify } = require('./blockNameify');
|
||||||
|
|
||||||
const dasherize = utils.dasherize;
|
const dasherize = utils.dasherize;
|
||||||
const nameify = utils.nameify;
|
const nameify = utils.nameify;
|
||||||
@ -56,9 +57,6 @@ function prepareChallenge(challenge) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
challenge.block = dasherize(challenge.block);
|
challenge.block = dasherize(challenge.block);
|
||||||
challenge.superBlock = challenge.superBlock
|
challenge.superBlock = blockNameify(challenge.superBlock);
|
||||||
.split('-')
|
|
||||||
.map(word => _.capitalize(word))
|
|
||||||
.join(' ');
|
|
||||||
return challenge;
|
return challenge;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user