Fix: Hint Button (#196)
* Create a guide URL for each challenge * Format
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
09836f1294
commit
1973376496
@ -20,7 +20,9 @@ function Header() {
|
|||||||
<Link to='/'>Curriculum</Link>
|
<Link to='/'>Curriculum</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='https://forum.freecodecamp.org' target='_blank'>Forum</a>
|
<a href='https://forum.freecodecamp.org' target='_blank'>
|
||||||
|
Forum
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<UserState />
|
<UserState />
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const cdnAddr = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/' +
|
const cdnAddr =
|
||||||
'2.7.4/MathJax.js?config=TeX-AMS_HTML';
|
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/' +
|
||||||
|
'2.7.4/MathJax.js?config=TeX-AMS_HTML';
|
||||||
|
|
||||||
const mathjax = [
|
const mathjax = [<script key='mathjax' src={cdnAddr} type='text/javascript' />];
|
||||||
<script
|
|
||||||
key='mathjax'
|
export default mathjax;
|
||||||
type='text/javascript'
|
|
||||||
src={cdnAddr}
|
|
||||||
/>
|
|
||||||
];
|
|
||||||
|
|
||||||
export default mathjax;
|
|
||||||
|
@ -27,6 +27,7 @@ import {
|
|||||||
Form
|
Form
|
||||||
} from '../../../components/formHelpers';
|
} from '../../../components/formHelpers';
|
||||||
import Spacer from '../../../components/util/Spacer';
|
import Spacer from '../../../components/util/Spacer';
|
||||||
|
import { createGuideUrl } from '../utils';
|
||||||
|
|
||||||
// provided by redux form
|
// provided by redux form
|
||||||
const reduxFormPropTypes = {
|
const reduxFormPropTypes = {
|
||||||
@ -105,7 +106,9 @@ export class BackEnd extends PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
data: { challengeNode: { fields: { blockName }, title, description } },
|
data: {
|
||||||
|
challengeNode: { fields: { blockName, slug }, title, description }
|
||||||
|
},
|
||||||
output,
|
output,
|
||||||
tests,
|
tests,
|
||||||
submitting,
|
submitting,
|
||||||
@ -133,7 +136,7 @@ export class BackEnd extends PureComponent {
|
|||||||
options={options}
|
options={options}
|
||||||
submit={executeChallenge}
|
submit={executeChallenge}
|
||||||
/>
|
/>
|
||||||
<ProjectToolPanel />
|
<ProjectToolPanel guideUrl={createGuideUrl(slug)} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<br />
|
<br />
|
||||||
@ -181,6 +184,7 @@ export const query = graphql`
|
|||||||
challengeType
|
challengeType
|
||||||
fields {
|
fields {
|
||||||
blockName
|
blockName
|
||||||
|
slug
|
||||||
tests {
|
tests {
|
||||||
text
|
text
|
||||||
testString
|
testString
|
||||||
|
@ -16,7 +16,7 @@ import HelpModal from '../components/HelpModal';
|
|||||||
import ResetModal from '../components/ResetModal';
|
import ResetModal from '../components/ResetModal';
|
||||||
|
|
||||||
import { randomCompliment } from '../utils/get-words';
|
import { randomCompliment } from '../utils/get-words';
|
||||||
|
import { createGuideUrl } from '../utils';
|
||||||
import { challengeTypes } from '../../../../utils/challengeTypes';
|
import { challengeTypes } from '../../../../utils/challengeTypes';
|
||||||
import { ChallengeNode } from '../../../redux/propTypes';
|
import { ChallengeNode } from '../../../redux/propTypes';
|
||||||
import {
|
import {
|
||||||
@ -160,10 +160,9 @@ class ShowClassic extends PureComponent {
|
|||||||
data: {
|
data: {
|
||||||
challengeNode: {
|
challengeNode: {
|
||||||
challengeType,
|
challengeType,
|
||||||
fields: { blockName },
|
fields: { blockName, slug },
|
||||||
title,
|
title,
|
||||||
description,
|
description
|
||||||
guideUrl
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
files,
|
files,
|
||||||
@ -220,7 +219,7 @@ class ShowClassic extends PureComponent {
|
|||||||
<SidePanel
|
<SidePanel
|
||||||
className='full-height'
|
className='full-height'
|
||||||
description={description}
|
description={description}
|
||||||
guideUrl={guideUrl}
|
guideUrl={createGuideUrl(slug)}
|
||||||
title={blockNameTitle}
|
title={blockNameTitle}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
@ -228,8 +227,9 @@ class ShowClassic extends PureComponent {
|
|||||||
<ReflexElement flex={1} {...this.resizeProps}>
|
<ReflexElement flex={1} {...this.resizeProps}>
|
||||||
{editors}
|
{editors}
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
{showPreview &&
|
{showPreview && (
|
||||||
<ReflexSplitter propagate={true} {...this.resizeProps} />}
|
<ReflexSplitter propagate={true} {...this.resizeProps} />
|
||||||
|
)}
|
||||||
{showPreview ? (
|
{showPreview ? (
|
||||||
<ReflexElement flex={0.7} {...this.resizeProps}>
|
<ReflexElement flex={0.7} {...this.resizeProps}>
|
||||||
<Preview
|
<Preview
|
||||||
@ -257,10 +257,10 @@ export const query = graphql`
|
|||||||
query ClassicChallenge($slug: String!) {
|
query ClassicChallenge($slug: String!) {
|
||||||
challengeNode(fields: { slug: { eq: $slug } }) {
|
challengeNode(fields: { slug: { eq: $slug } }) {
|
||||||
title
|
title
|
||||||
guideUrl
|
|
||||||
description
|
description
|
||||||
challengeType
|
challengeType
|
||||||
fields {
|
fields {
|
||||||
|
slug
|
||||||
blockName
|
blockName
|
||||||
tests {
|
tests {
|
||||||
text
|
text
|
||||||
|
@ -21,7 +21,7 @@ const options = {
|
|||||||
horizontal: 'hidden',
|
horizontal: 'hidden',
|
||||||
vertical: 'visible',
|
vertical: 'visible',
|
||||||
verticalHasArrows: true
|
verticalHasArrows: true
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Output extends PureComponent {
|
class Output extends PureComponent {
|
||||||
|
@ -63,30 +63,34 @@ export class ProjectForm extends PureComponent {
|
|||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.key === 'Control') {
|
if (e.key === 'Control') {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state, keysDown: { ...state.keysDown, Control: true }
|
...state,
|
||||||
|
keysDown: { ...state.keysDown, Control: true }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state, keysDown: { ...state.keysDown, Enter: true }
|
...state,
|
||||||
|
keysDown: { ...state.keysDown, Enter: true }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleKeyUp(e) {
|
handleKeyUp(e) {
|
||||||
if (e.key === 'Control') {
|
if (e.key === 'Control') {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state, keysDown: { ...state.keysDown, Control: false }
|
...state,
|
||||||
|
keysDown: { ...state.keysDown, Control: false }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
...state, keysDown: { ...state.keysDown, Enter: false }
|
...state,
|
||||||
|
keysDown: { ...state.keysDown, Enter: false }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleSubmit(values) {
|
handleSubmit(values) {
|
||||||
const { keysDown: { Control, Enter } } = this.state;
|
const { keysDown: { Control, Enter } } = this.state;
|
||||||
if (Control && Enter || !Enter) {
|
if ((Control && Enter) || !Enter) {
|
||||||
this.props.openModal('completion');
|
this.props.openModal('completion');
|
||||||
this.props.updateProjectForm(values);
|
this.props.updateProjectForm(values);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import { frontEndProject } from '../../../../utils/challengeTypes';
|
|||||||
|
|
||||||
import './project.css';
|
import './project.css';
|
||||||
import Spacer from '../../../components/util/Spacer';
|
import Spacer from '../../../components/util/Spacer';
|
||||||
|
import { createGuideUrl } from '../utils';
|
||||||
|
|
||||||
const mapStateToProps = () => ({});
|
const mapStateToProps = () => ({});
|
||||||
const mapDispatchToProps = dispatch =>
|
const mapDispatchToProps = dispatch =>
|
||||||
@ -92,7 +93,7 @@ export class Project extends PureComponent {
|
|||||||
data: {
|
data: {
|
||||||
challengeNode: {
|
challengeNode: {
|
||||||
challengeType,
|
challengeType,
|
||||||
fields: { blockName },
|
fields: { blockName, slug },
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
guideUrl
|
guideUrl
|
||||||
@ -119,7 +120,7 @@ export class Project extends PureComponent {
|
|||||||
openModal={openCompletionModal}
|
openModal={openCompletionModal}
|
||||||
updateProjectForm={updateProjectFormValues}
|
updateProjectForm={updateProjectFormValues}
|
||||||
/>
|
/>
|
||||||
<ToolPanel />
|
<ToolPanel guideUrl={createGuideUrl(slug)} />
|
||||||
<Spacer />
|
<Spacer />
|
||||||
</div>
|
</div>
|
||||||
<CompletionModal />
|
<CompletionModal />
|
||||||
@ -138,11 +139,11 @@ export const query = graphql`
|
|||||||
query ProjectChallenge($slug: String!) {
|
query ProjectChallenge($slug: String!) {
|
||||||
challengeNode(fields: { slug: { eq: $slug } }) {
|
challengeNode(fields: { slug: { eq: $slug } }) {
|
||||||
title
|
title
|
||||||
guideUrl
|
|
||||||
description
|
description
|
||||||
challengeType
|
challengeType
|
||||||
fields {
|
fields {
|
||||||
blockName
|
blockName
|
||||||
|
slug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
packages/learn/src/templates/Challenges/utils/index.js
Normal file
5
packages/learn/src/templates/Challenges/utils/index.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const guideBase = 'https://guide.freecodecamp.org/certifications';
|
||||||
|
|
||||||
|
export function createGuideUrl(slug = '') {
|
||||||
|
return guideBase + slug;
|
||||||
|
}
|
Reference in New Issue
Block a user