diff --git a/common/app/App.jsx b/common/app/App.jsx index 28ec870e0c..de4fb7722d 100644 --- a/common/app/App.jsx +++ b/common/app/App.jsx @@ -11,7 +11,8 @@ import { toggleMapDrawer, toggleMainChat, updateAppLang, - trackEvent + trackEvent, + loadCurrentChallenge } from './redux/actions'; import { submitChallenge } from './routes/challenges/redux/actions'; @@ -28,7 +29,8 @@ const bindableActions = { toggleMapDrawer, toggleMainChat, updateAppLang, - trackEvent + trackEvent, + loadCurrentChallenge }; const mapStateToProps = createSelector( @@ -80,7 +82,8 @@ export class FreeCodeCamp extends React.Component { shouldShowSignIn: PropTypes.bool, params: PropTypes.object, updateAppLang: PropTypes.func.isRequired, - trackEvent: PropTypes.func.isRequired + trackEvent: PropTypes.func.isRequired, + loadCurrentChallenge: PropTypes.func.isRequired }; componentWillReceiveProps(nextProps) { @@ -124,7 +127,8 @@ export class FreeCodeCamp extends React.Component { toggleMainChat, shouldShowSignIn, params: { lang }, - trackEvent + trackEvent, + loadCurrentChallenge } = this.props; const navProps = { isOnMap: router.isActive(`/${lang}/map`), @@ -135,7 +139,8 @@ export class FreeCodeCamp extends React.Component { toggleMapDrawer, toggleMainChat, shouldShowSignIn, - trackEvent + trackEvent, + loadCurrentChallenge }; return ( diff --git a/common/app/components/Nav/Nav.jsx b/common/app/components/Nav/Nav.jsx index a3c60b4894..fd8b6f9412 100644 --- a/common/app/components/Nav/Nav.jsx +++ b/common/app/components/Nav/Nav.jsx @@ -15,16 +15,6 @@ import AvatarNavItem from './Avatar-Nav-Item.jsx'; const fCClogo = 'https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg'; -const logoElement = ( - - learn to code javascript at Free Code Camp logo - -); - const toggleButtonChild = ( Menu @@ -43,6 +33,7 @@ export default class extends React.Component { constructor(...props) { super(...props); this.handleMapClickOnMap = this.handleMapClickOnMap.bind(this); + this.handleLogoClick = this.handleLogoClick.bind(this); navLinks.forEach(({ content }) => { this[`handle${content}Click`] = handleNavLinkEvent.bind(this, content); }); @@ -58,7 +49,8 @@ export default class extends React.Component { toggleMapDrawer: PropTypes.func, toggleMainChat: PropTypes.func, shouldShowSignIn: PropTypes.bool, - trackEvent: PropTypes.func.isRequired + trackEvent: PropTypes.func.isRequired, + loadCurrentChallenge: PropTypes.func.isRequired }; componentDidMount() { @@ -83,6 +75,11 @@ export default class extends React.Component { }); } + handleLogoClick(e) { + e.preventDefault(); + this.props.loadCurrentChallenge(); + } + renderMapLink(isOnMap, toggleMapDrawer) { if (isOnMap) { return ( @@ -218,7 +215,18 @@ export default class extends React.Component { className='nav-height' fixedTop={ true } > - { logoElement } + + + learn to code javascript at Free Code Camp logo + +