{% load staticfiles i18n account_tags lazysignup_tags nav_extras %}

<nav class="uk-navbar-container" uk-navbar>
  <div class="uk-navbar-left">
    <ul class="uk-navbar-nav">
      <li><a href="{% url 'home' %}"><img src="{% static 'img/keen_logo.svg' %}" width="90"/></a></li>
      </ul>
  </div>

  {# no tools links if not logged in #}
  {% if not user.is_anonymous %}

  <div class="uk-navbar-center">
    <ul class="uk-navbar-nav">
      <li class="{% if_in_app 'dashboard' 'uk-active' %}">
        <a href="{% url 'home' %}">{% trans "Dashboard" %}</a>
      </li>

      <li class="uk-parent{% if_in_app 'cataloglist' ' uk-active' %}">
        <a>{% trans "Catalogs" %}</a>
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="{% url 'catalogedit' %}">New catalog</a></li>
            <li><a href="{% url 'cataloglist' %}">Catalog list</a></li>
          </ul>
        </div>
      </li>

      <li class="uk-parent{% if_in_app 'imagetools' ' uk-active' %}">
        <a>{% trans "Images" %}</a>
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="http://a.keen.procatalog.io/tools/downloader/">Image downloader</a></li>
            {% if not user|is_lazy_user %}
            <li><a href="http://a.keen.procatalog.io/images/upload">Image uploader</a></li>
            <li><a href="http://a.keen.procatalog.io/tools/status">Image status</a></li>
            {% endif %}
          </ul>
        </div>
      </li>

      {% if not user|is_lazy_user %}
      <li class="uk-parent{% if_in_app 'tools' ' uk-active' %}">
        <a>{% trans "Tools" %}</a>
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="http://a.keen.procatalog.io/tools/regionizer/">Region editor</a></li>
          </ul>
        </div>
      </li>
      {% endif %}

    </ul>
  </div>

  {% endif %}

  <div class="uk-navbar-right">
    <ul class="uk-navbar-nav">

      <li class="uk-parent">
        <a>{% trans "Support" %}</a>
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="mailto:support@procatalog.io?Subject=Keen%20ProCatalog%20support%20request">Email support</a></li>
            <li><a href="https://keenfootwear.wistia.com/medias/ld970jfi9o" target="_blank">Catalog creation tutorial</a></li>
          </ul>
        </div>
      </li>

      <li class="uk-parent{% if_in_app 'account' ' uk-active' %}">
        <a href="#">{% username %}</a>

        {% if user.is_anonymous %}
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="{% url 'account_login' %}">{% trans "Log in" %}</a></li>
            <li><a href="{% url 'account_signup' %}">{% trans "Sign up" %}</a></li>
          </ul>
        </div>

        {% elif user|is_lazy_user %}
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="{% url 'lazysignup_convert' %}">{% trans "Create account" %}</a></li>
            <li><a href="{% url 'account_logout' %}">{% trans "Log out" %}</a></li>
          </ul>
        </div>

        {% else %}
        <div class="uk-navbar-dropdown">
          <ul class="uk-nav uk-navbar-dropdown-nav">
            <li><a href="{% url 'account_settings' %}">{% trans "Profile" %}</a></li>
            <li class="uk-nav-divider"></li>
            <li><a href="{% url 'account_logout' %}">{% trans "Log out" %}</a></li>
          </ul>
        </div>

        {% endif %}
      </li>
    </ul>
  </div>
</nav>
