<header class="np-header np-header-color">
  <div class="np-header-content">
    <div class="np-hidden-desktop np-header-mobile-menu-nav">
      {% if current_person.signed_in? %}
        <button
          data-toggle-class="np-hidden"
          class="np-header-mobile-menu-nav-button fal fa-times np-hidden np-header-font-color"
          data-toggle-target=".np-header-mobile-avatar-menu,
          .np-header-mobile-menu-content, .np-main, .np-footer"
        ></button>
        <button
          data-test="open-mobile-menu"
          data-toggle-class="np-hidden"
          class="np-header-mobile-menu-nav-button np-header-mobile-avatar-menu"
          data-toggle-target=".fa-times, .np-header-mobile-menu-content, .np-main, .np-footer"
        >
          <img
            alt="{{ current_person.name }}"
            class="np-header-avatar-image"
            src="{{ current_person.avatar_url }}"
          />
        </button>
      {% endif %}
    </div>
      <h1 class="np-header-logo">
        <a href="{% route home %}">
          <img
            alt="{{ current_school.name }}"
            class="np-header-logo-image"
            src="https://s3.amazonaws.com/static.northpass.com/demos/kitman/Kitman+Labs+Logo.png"
          />
        </a>
      </h1>

    <div class="np-hidden-mobile np-header-desktop-nav">
      <ul class="np-header-desktop-nav-list">

        {% comment %} Partner Training {% endcomment %}
        {% assign navigation_my_training = navigations.sub_navigation | where: "label", "partner-training" | first %}
        {% include "header_desktop_menu_item", label: "Partner Training", url: '/app/partner-training', external: false %}

        {% comment %} All Courses {% endcomment %}
        {% include "header_desktop_menu_item", label: 'Courses', url: '/app/courses', external: false %}

        {% comment %} Learning Paths {% endcomment %}
        {% assign navigation_guides = navigations.sub_navigation | where: "label", "Learning Paths" | first %}
        {% include "header_desktop_menu_item", label: "Learning Paths", url: navigation_guides.url, external: false %}

        {% comment %} Events {% endcomment %}
        {% assign navigation_events = navigations.sub_navigation | where: "label", "Events" | first %}
        {% include "header_desktop_menu_item", label: navigation_events.label, url: navigation_events.url, external: false %}

        {% for website_navigation in navigations.header_navigations_external %}
          {% include "header_desktop_menu_item", label: website_navigation.name, url: website_navigation.path, external: true %}
        {% endfor %}
      </ul>
    </div>

    {% if current_person.signed_in? %}
      <div class="np-hidden-mobile np-header-search np-header-search-expanded">
        <form action="{% route search %}" method="get" data-test="desktop-search">
          <input
            aria-label="{% t .search %}"
            class="np-header-search-input np-header-font-background-color"
            type="text"
            name="q"
            placeholder="{% t .search %}"
          />
          <i class="np-header-search-icon far fa-search" aria-label="Search"></i>
        </form>
      </div>
      <div class="np-hidden-mobile np-header-avatar">
        <button
          class="np-header-avatar-button"
          data-test="open-desktop-menu"
          data-toggle-class-on-target="np-hidden"
          data-toggle-target=".np-header-avatar-tooltip"
          data-toggle-outside
        >
          <img
            alt="{{ current_person.name }}"
            class="np-header-avatar-image"
            src="{{ current_person.avatar_url }}"
          >
        </button>
        <div class="np-header-avatar-tooltip np-hidden" role="tooltip">
          <span class="np-header-avatar-tooltip-arrow-up"></span>
          <div class="np-header-avatar-tooltip-learner">
            <div class="np-header-avatar-tooltip-learner-name">
              {{ current_person.name }}
            </div>
            <div class="np-header-avatar-tooltip-learner-email">
              {{ current_person.email }}
            </div>
          </div>
          <nav class="np-header-avatar-tooltip-navigation">
          {% unless current_school.sso_active? %}
            <a
              class="np-header-avatar-tooltip-navigation-link"
              href="{% route account %}"
            >
              {% t .profile_settings %}
            </a>
          {% endunless %}
            <a
              class="np-header-avatar-tooltip-navigation-link np-danger"
              href="{% route logout %}"
            >
              {% t .sign_out %}
            </a>
          </nav>
        </div>
      </div>
    {% else %}
      <a
        class="np-header-sign-in np-header-desktop-nav-link np-header-font-color"
        href="{% route login %}"
      >
        {% t shared.sign_in %}
      </div>
    {% endif %}
  </div>
</header>

<div class="np-hidden-desktop">
  <div class="np-header-mobile-menu-content np-hidden">
    {% if current_person.signed_in? %}
      <img
        alt="{{ current_person.name }}"
        class="np-header-mobile-menu-content-avatar"
        src="{{ current_person.avatar_url }}"
      />
      <div class="np-header-mobile-menu-content-name">
        {{ current_person.name }}
      </div>
    {% endif %}
    <div class="np-header-mobile-menu-content-nav">
      <form
        class="np-header-search"
        data-test="mobile-search"
        method="get"
        action="{% route search %}"
      >
        <input
          aria-label="{% t .search %}"
          class="np-header-search-input"
          type="text"
          name="q"
          placeholder="{% t .search %}"
        />
        <i class="np-header-search-icon far fa-search" aria-label="search"></i>
      </form>

      {% comment %} Home {% endcomment %}
      {% assign mobile_navigation_home = navigations.header_navigations | where: "name", "Home" | first %}
      {% include "header_mobile_menu_item", label: mobile_navigation_home.name, url: mobile_navigation_home.path, external: false %}

      {% comment %} Dashboard {% endcomment %}
      {% assign mobile_navigation_my_training = navigations.header_navigations | where: "name", "Dashboard" | first %}
      {% include "header_mobile_menu_item", label: "Dashboard", url: mobile_navigation_my_training.path, external: false %}

      {% comment %} All Courses {% endcomment %}
      {% include "header_mobile_menu_item", label: "Tutorials", url: "/app/courses", external: false %}

      {% comment %} Learning Paths {% endcomment %}
      {% assign mobile_navigation_guides = navigations.header_navigations | where: "name", "Learning Paths" | first %}
      {% include "header_mobile_menu_item", label: "Learning Paths", url: mobile_navigation_guides.path, external: false %}

      {% comment %} Events {% endcomment %}
      {% assign mobile_navigation_events = navigations.header_navigations | where: "name", "Events" | first %}
      {% include "header_mobile_menu_item", label: mobile_navigation_events.name, url: mobile_navigation_events.path, external: false %}

      {% comment %} External Links {% endcomment %}
      {% assign mobile_navigation_external = navigations.header_navigations | where: "external?", true %}
      {% for website_navigation in mobile_navigation_external %}
        {% include "header_mobile_menu_item", label: website_navigation.name, url: website_navigation.path, external: true %}
      {% endfor %}

      <div class="np-header-mobile-menu-content-line"></div>
      {% unless current_school.sso_active? %}
        <a
          class="np-header-mobile-menu-content-button"
          href="{% route account %}"
        >
          {% t .profile_settings %}
        </a>
      {% endunless %}
      <a
        class="np-header-mobile-menu-content-button np-danger"
        href="{% route logout %}"
      >
        {% t .sign_out %}
      </a>
    </div>
  </div>
</div>

{% include "messages" %}
