{% extends 'allianceauth/base-bs5.html' %}
{% load humanize %}
{% load i18n %}

{% block page_title %}{{ app_title }}{% endblock %}

{% block header_nav_brand %}{{ app_title }}{% endblock %}

{% block header_nav_collapse_left %}
    <li role="presentation" class="nav-item">
        <a
            class="nav-link{% if not outdated_count or filter != 'current' and filter != 'outdated' and filter != 'unknown' %} active{% endif %}"
            href="{% url 'package_monitor:index' %}?filter=all"
        >
            {% translate "All Packages" %}
            &nbsp;<span class="badge text-bg-secondary">{{ all_count }}</span>
        </a>
    </li>

    {% if outdated_count %}
        <li role="presentation" class="nav-item">
            <a
                class="nav-link{% if filter == 'current' %} active{% endif %}"
                href="{% url 'package_monitor:index' %}?filter=current"
            >
                {% translate "Current" %}
                &nbsp;<span class="badge text-bg-secondary">{{ current_count }}</span>
            </a>
        </li>

        <li role="presentation" class="nav-item">
            <a
                class="nav-link{% if filter == 'outdated' %} active{% endif %}"
                href="{% url 'package_monitor:index' %}?filter=outdated"
            >
                {% translate "Update Available" %}
                {% if outdated_count > 0 %}&nbsp;<span class="badge text-bg-danger">{{ outdated_count }}</span>{% endif%}
            </a>
        </li>
    {% endif %}

    {% if unknown_count %}
        <li role="presentation" class="nav-item">
            <a
                class="nav-link dotted_underline{% if filter == 'unknown' %} active{% endif %}"
                href="{% url 'package_monitor:index' %}?filter=unknown"
                title="{% translate 'No information about releases available on PyPI' %}"
                data-bs-tooltip="aa-package-monitor"
            >
                {% translate 'Unknown packages' %}
                {% if outdated_count > 0 %}&nbsp;<span class="badge text-bg-secondary">{{ unknown_count }}</span>{% endif%}
            </a>
        </li>
    {% endif %}
{% endblock %}

{% block header_nav_user_character_control %}
    {% comment %}
        Leave empty to remove user control nav items for this app
    {% endcomment %}
{% endblock %}

{% block header_nav_collapse_right %}
    <li role="presentation" class="nav-item">
        <span class="nav-link">
            {% translate "not yet" as never_text %}
            {% translate 'Last updated' %} {{ updated_at|naturaltime|default_if_none:never_text }}
        </span>
    </li>

    <li role="presentation" class="nav-item">
        <button
            type="button"
            class="btn btn-sm btn-success btn-refresh-package-data mt-1"
            data-bs-toggle="modal"
            data-bs-target="#modalRefreshingDistributions"
            title="{% translate 'Refresh data now' %}"
            data-bs-tooltip="aa-package-monitor"
        >
            <i class="fa-solid fa-sync"></i>
        </button>
    </li>
{% endblock %}

{% block content %}
    <div class="aa-package-monitor">
        {% block aa_package_monitor %}{% endblock aa_package_monitor %}
    </div>
{% endblock content %}
