{% trans_default_domain 'fediplan' %}
<header>
    <!-- Fixed navbar -->
    <nav class="navbar navbar-expand-md navbar-light fixed-top bg-light">
        <a class="navbar-brand" href="#">FediPlan</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="navbar-nav mr-auto">
                {% if not is_granted('ROLE_USER') %}
                <li class="nav-item {% if app.request.attributes.get('_route') == 'index' %} active {% endif %}">
                    <a class="nav-link" href="{{ path('index') }}">{{ 'common.login'|trans }} <span class="sr-only">(current)</span></a>
                </li>
                {% endif %}
                {% if is_granted('ROLE_USER') %}
                <li class="nav-item {% if app.request.attributes.get('_route') == 'schedule' %}active {% endif %}">
                    <a class="nav-link" href="{{ path('schedule') }}">{{ 'common.schedule'|trans }}</a>
                </li>

                <li class="nav-item {% if app.request.attributes.get('_route') == 'scheduled' %} active {% endif %}">
                    <a class="nav-link" href="{{ path('scheduled') }}">{{ 'common.scheduled'|trans }}</a>
                </li>

                <li class="nav-item">
                    <a class="nav-link" href="{{ path('logout') }}" tabindex="-1" >{{ 'common.logout'|trans }}</a>
                </li>
                {% endif %}
                <li class="nav-item {% if app.request.attributes.get('_route') == 'about' %} active {% endif %}">
                    <a class="nav-link" href="{{ path('about') }}" tabindex="-1" >{{ 'common.about'|trans }}</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="https://fedilab.app/page/donations/" tabindex="-1" >{{ 'common.support_my_work'|trans }}</a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                        {% set flagLink = "img/flags/"~app.request.locale~".svg" %}
                        <img src="{{ asset(flagLink) }}" alt="language" width="30">
                    </a>
                    <div class="dropdown-menu">
                        {% set route =  app.request.attributes.get('_route') %}
                        {% if route == "app_fediplan_about" %}
                            {% set route = "about" %}
                        {% endif %}
                        <a class="dropdown-item" href="{{ path(route, {'_locale':'en' }) }}">English</a>
                        <a class="dropdown-item"  href="{{ path(route, {'_locale':'fr' }) }}">Français</a>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
</header>