{% trans_default_domain 'fediplan' %}
<header>
    <!-- Fixed navbar -->
    <nav class="navbar fixed-top navbar-expand-lg bg-body-tertiary">
        <div class="container-fluid">
            <a class="navbar-brand" href="#">
                <img src="{{ asset('img/FediPlan.png') }}" alt="Logo" width="24" height="24" class="d-inline-block align-text-top"/>
                FediPlan
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
                <div class="offcanvas-header">
                    <h5 class="offcanvas-title" id="offcanvasNavbarLabel">
                        <img src="{{ asset('img/FediPlan.png') }}" alt="Logo" width="24" height="24" class="d-inline-block align-text-top"/>
                        FediPlan
                    </h5>
                    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
                </div>
                <div class="offcanvas-body">
                    <ul class="navbar-nav flex-grow-1 pe-3">
                        {% 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" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                {{ getLanguage(app.request.locale) }}
                            </a>
                            <ul class="dropdown-menu scrollable-menu">
                                {% set route =  app.request.attributes.get('_route') %}
                                {% if route == "app_fediplan_about" %}
                                    {% set route = "about" %}
                                {% endif %}
                                {% if route | length < 5 %}
                                    {% set route = "index" %}
                                {% endif %}
                                <li><a class="dropdown-item" href="{{ path(route, {'_locale':'en' }) }}">English</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'fr' }) }}">Français</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'de' }) }}">Deutsch</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'nl' }) }}">Nederlands</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'ar' }) }}">العربية</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'it' }) }}">Italiano</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'pt-PT' }) }}">Português</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'pt-BR' }) }}">Brasil</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'ca' }) }}">Català</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'ja' }) }}">日本語</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'pl' }) }}">Polski</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'ru' }) }}">Русский</a></li>
                                <li><a class="dropdown-item"  href="{{ path(route, {'_locale':'uk' }) }}">Украïна</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </nav>
</header>