{% load static %}
{% load i18n %}
{% load main_extras %}
<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>
      {% block title %}Nummi{% endblock %}
    </title>
    {% block link %}
      <link rel="icon" href="{% static "main/svg/logo.svg" %}" type="image/svg+xml">
      {% css "main/css/main.css" %}
      {% js "main/js/base.js" %}
    {% endblock %}
  </head>
  <body>
    {% block nav %}
      {% spaceless %}
        <nav>
          <h1>
            <img src="{% static "main/svg/logo.svg" %}" alt="">
            Nummi
          </h1>
          <ul>
            <li>
              <a class="skip-link" href="#main">{% translate "Skip to main content" %}</a>
            </li>
            {% if user.is_authenticated %}
              <li>
                <a href="{% url "index" %}"
                   class="home{% if request.resolver_match.url_name == "index" %} cur{% endif %}"
                   accesskey="h">
                  <span>{% translate "Home" %}</span>
                  {{ "home"|remix }}
                </a>
              </li>
              <li>
                <a href="{% url "statements" %}"
                   class="{% if request.resolver_match.url_name == "statements" %}cur{% endif %}">
                  <span>{% translate "Statements" %}</span>
                  {{ "file"|remix }}
                </a>
              </li>
              <li>
                <a href="{% url "transactions" %}"
                   class="{% if request.resolver_match.url_name == "transactions" %}cur{% endif %}">
                  <span>{% translate "Transactions" %}</span>
                  {{ "receipt"|remix }}
                </a>
              </li>
              <li>
                <a href="{% url "search" %}"
                   class="{% if request.resolver_match.url_name == "search" %}cur{% endif %}"
                   accesskey="r">
                  <span>{% translate "Search" %}</span>
                  {{ "search"|remix }}
                </a>
              </li>
              <li>
                {% blocktranslate %}Logged in as <strong>{{ user }}</strong>{% endblocktranslate %}
              </li>
              <li>
                <a href="{% url "logout" %}" accesskey="l">
                  <span>{% translate "Log out" %}</span>
                  {{ "close-circle"|remix }}
                </a>
              </li>
            {% else %}
              <li>
                <a {% if request.resolver_match.url_name == "login" %}class="cur"{% endif %}
                   href="{% url "login" %}">
                  <span>{% translate "Log in" %}</span>
                  {{ "user"|remix }}
                </a>
              </li>
            {% endif %}
          </ul>
        </nav>
      {% endspaceless %}
    {% endblock %}
    <main id="main">
      {% if messages %}
        <ul class="messages">
          {% for message in messages %}
            <li class="msg-level-{{ message.level }}">
              {{ message.level|messageicon }}{{ message }}
            </li>
          {% endfor %}
        </ul>
      {% endif %}
      {% block body %}{% endblock %}
    </main>
  </body>
</html>
