{% from 'bootstrap5/nav.html' import render_nav_item %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
    <div class="container-fluid">
        <a class="navbar-brand" href="{{ url_for("main.index") }}">Benchmark</a>
        <button class="navbar-toggler"
                type="button"
                data-bs-toggle="collapse"
                data-bs-target="#navbarToggler"
                aria-controls="navbarToggler"
                aria-expanded="false"
                aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarToggler">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                {% if current_user.is_authenticated %}
                    <li class="nav-benchmark">
                        <a href="{{ url_for(config.INDEX) }}"
                           class="nav-item nav-link nav-benchmark">on {{ current_user.benchmark.name }}</a>
                    </li>
                    <li>{{ render_nav_item('results.select', 'Results') }}</li>
                    <li>{{ render_nav_item('results.datasets', 'Datasets') }}</li>
                    <li>{{ render_nav_item('interactive.ranking', 'Ranking') }}</li>
                    <li>{{ render_nav_item('interactive.experiment', 'Experiment') }}</li>
                    <li>{{ render_nav_item('main.config', 'Config') }}</li>
                {% endif %}
            </ul>
            <div class="navbar-nav justify-content-end">
                {% if current_user.is_authenticated %}
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle"
                           href="#"
                           id="navbarDarkDropdownMenuLink"
                           role="button"
                           data-bs-toggle="dropdown"
                           aria-expanded="false">
                            <img src='{{ current_user.avatar(40) }}' height=35 alt="gravatar" />
                            {{ current_user.username }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-dark"
                            aria-labelledby="navbarDarkDropdownMenuLink">
                            {% if current_user.admin %}
                                {{ render_nav_item('admin.users', 'Users') |safe }}
                                {{ render_nav_item('admin.benchmarks', 'Benchmarks') |safe }}
                            {% endif %}
                            <a class="nav-item nav-link"
                               href="{{ url_for("admin.password", user_id=current_user.id) }}">Password</a>
                            {{ render_nav_item('main.logout', 'Logout') |safe }}
                        </ul>
                    </li>
                {% else %}
                    {{ render_nav_item('main.login', 'Login') }}
                {% endif %}
            </div>
        </div>
    </div>
</nav>
