diff --git a/client/src/templates/Challenges/components/Challenge-Title.js b/client/src/templates/Challenges/components/Challenge-Title.js index e036ee0293..3a8d91b46e 100644 --- a/client/src/templates/Challenges/components/Challenge-Title.js +++ b/client/src/templates/Challenges/components/Challenge-Title.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import Link from '../../../components/helpers/Link'; import './challenge-title.css'; +import GreenPass from '../../../assets/icons/GreenPass'; const propTypes = { children: PropTypes.string, @@ -21,13 +22,6 @@ function ChallengeTitle({ prevChallengePath, showPrevNextBtns }) { - let icon = null; - if (isCompleted) { - icon = ( - // TODO Use SVG here - - ); - } return (
{showPrevNextBtns ? ( @@ -41,7 +35,11 @@ function ChallengeTitle({ ) : null}

{children || 'Happy Coding!'} - {icon} + {isCompleted ? ( + + ) : null}

{showPrevNextBtns ? ( ({ + (isChallengeCompleted, tests) => ({ + isChallengeCompleted, tests }) ); @@ -25,6 +27,7 @@ const propTypes = { guideUrl: PropTypes.string, instructions: PropTypes.string, introPath: PropTypes.string, + isChallengeCompleted: PropTypes.bool, nextChallengePath: PropTypes.string, prevChallengePath: PropTypes.string, section: PropTypes.string, @@ -59,6 +62,7 @@ export class SidePanel extends Component { description, instructions, introPath, + isChallengeCompleted, guideUrl, nextChallengePath, prevChallengePath, @@ -73,6 +77,7 @@ export class SidePanel extends Component {
renders correctly 1`] = ` className="text-center challenge-title" > title text - + + Passed + + + + + Passed + + + + + + state[ns].challengeFiles; export const challengeMetaSelector = state => state[ns].challengeMeta; export const challengeTestsSelector = state => state[ns].challengeTests; export const consoleOutputSelector = state => state[ns].consoleOut; +export const isChallengeCompletedSelector = state => { + const completedChallenges = completedChallengesSelector(state); + const { id: currentChallengeId } = challengeMetaSelector(state); + return completedChallenges.some(({ id }) => id === currentChallengeId); +}; export const isCodeLockedSelector = state => state[ns].isCodeLocked; export const isCompletionModalOpenSelector = state => state[ns].modal.completion;