nav.navbar.navbar-default.navbar-fixed-top.nav-height
    .navbar-header
        button.hamburger.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse')
            .col-xs-12
                span.hamburger-text Menu
        a.navbar-brand(href='/')
            img.img-responsive.nav-logo(src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg', alt='learn to code javascript at Free Code Camp logo')
    .collapse.navbar-collapse
        ul.nav.navbar-nav.navbar-right.hamburger-dropdown
            li
                a.learn-btn(href='#') Learn
            li
                a(href='/map') Map
            li
                a(href='//gitter.im/FreeCodeCamp/FreeCodeCamp', target='_blank') Chat
            li
                a(href='/news') News
            li
                a(href='//github.com/FreeCodeCamp/freecodecamp/wiki/Home', target='_blank') Wiki
            if !user
                li &thinsp; &thinsp; &thinsp;
                li
                    a.btn.signup-btn.signup-btn-nav(href='/login') Sign in
            else
              if user.isGithubCool
                li
                  a(href='/' + user.username) [&thinsp;#{user.progressTimestamps.length}&thinsp;]
                .hidden-xs.hidden-sm
                    a(href='/' + user.username)
                        img.profile-picture.float-right(src='#{user.picture}')
              else
                li
                    a(href='/account') [&thinsp;#{user.progressTimestamps.length}&thinsp;]
                .hidden-xs.hidden-sm
                    a(href='/account')
                        img.profile-picture.float-right(src='#{user.picture}')
script.
  $(document).ready(function() {
    $('.learn-btn').click(function(e) {
      var challengeDashedName = null;
      e.preventDefault();
      if (typeof dashedName === "string") {
          return location.reload();
      }
      if (typeof localStorage !== 'undefined') {
        challengeDashedName = localStorage.getItem('currentDashedName');
      }
      window.location = challengeDashedName ?
        '/challenges/' + challengeDashedName :
        '/map';
    });
  });
