{% load static %}

<!DOCTYPE html>
<html>
  <head>
    <title>Newreader</title>
    <link type="image/png" href="{% static 'favicon.png' %}" rel="shortcut icon" />
    {% block head %}
      <link href="{% static 'css/main.css' %}" rel="stylesheet" />
    {% endblock %}
  </head>

  <body class="body">
    <nav class="nav">
      <ol>
        {% if request.user.is_authenticated %}
          <li class="nav__item"><a href="{% url 'index' %}">Home</a></li>
          <li class="nav__item"><a href="{% url 'news:core:categories' %}">Categories</a></li>
          <li class="nav__item"><a href="{% url 'news:collection:rules' %}">Sources</a></li>
          <li class="nav__item"><a href="{% url 'accounts:settings:home' %}">Settings</a></li>
          {% if request.user.is_superuser %}
            <li class="nav__item"><a href="{% url 'admin:index' %}">Admin</a></li>
          {% endif %}
          <li class="nav__item"><a href="{% url 'accounts:logout' %}">Logout</a></li>
        {% else %}
          <li class="nav__item"><a href="{% url 'accounts:login' %}">Login</a></li>
          <li class="nav__item"><a href="{% url 'accounts:register' %}">Register</a></li>
        {% endif %}
      </ol>

      <i class="theme-switcher fas fa-adjust"></i>
    </nav>

    {% if messages %}
      <ul class="list messages">
        {% for message in messages %}
          <li class="messages__item {% if message.tags %}messages__item--{{ message.tags }}{% endif %}">
            {{ message }}
          </li>
        {% endfor %}
      </ul>
    {% endif %}

    {% block content %}{% endblock content %}
  </body>

  {% block scripts %}
      <script src="{% static 'js/main.bundle.js' %}"></script>
  {% endblock %}
</html>
