{% assign groupValidator = false %}
{% for group in current_person.groups %}
  {% if group %}
    {% assign groupValidator = true %}
  {% endif %}
{% endfor %}

{% if current_person.signed_in? and groupValidator == false %}
  {% unless current_person.email contains '+preview-' %}
    <script>
      if (window.location.pathname != '/app/sign-up-follow-up'){
        window.location.replace('/app/sign-up-follow-up');
      }
    </script>
  {% endunless %}
{% endif %}

<header>
    {% if current_school.logo_url %}
    <div class="mizuno-logo">
        <a href="{% route home %}">
          <img
            alt="{{ current_school.name }}"
            class="np-header-logo-image"
            src="{{ current_school.logo_url }}"
          />
        </a>
    </div>
    {% else %}
      <a href="{% route home %}" class="np-school-name np-header-font-color">
        {{ current_school.name }}
      </a>
    {% endif %}

    <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>

        {%- comment -%} Desktop Profile Tooltip {%- endcomment -%}
        <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>
</header>


{% include "messages" %}

<style>
  body {
    background:#fff;
  }

  header {
     background-color: #001588;
     display: flex;
     flex-direction: row;
     justify-content: space-between;
     padding-right: 70px;
  }

  .mizuno-logo{
    padding: 15px 0;
    display: flex;
    justify-content: center !important;
  }

  .np-header-logo-image {
    display: block;
    margin: auto;
    height: 120px;
  }

  @media screen and (min-width: 768px){
    .mizuno-logo {
      padding: 30px 70px;
      justify-content: flex-start !important;
    }
  }
</style>
