{% extends './barebone.njk' %}

{% block _stylesheets %}
    {{ super() }}
    <link rel="stylesheet" href="/css/app.css">
    {% block stylesheets %}{% endblock %}
{% endblock %}
{% block _scripts %}
    {{ super() }}
    {% block scripts %}{% endblock %}
{% endblock %}

{% block header %}
    <a href="/" class="logo"><img src="/img/logo.svg" alt="Logo"> {{ app.name }}</a>
    <nav>
        <button id="menu-button"><i data-feather="menu"></i></button>
        <ul id="main-menu">
            {% if user %}
                <li class="dropdown"><a href="{{ route('widgets') }}"><i data-feather="zap"></i> <span class="tip">Widgets</span></a></li>
                <div class="separator"></div>
                <li><a href="{{ route('account') }}"><i data-feather="user"></i> <span class="tip">{{ user.name }} - Account</span></a></li>

                {% if user.is_admin %}
                    <li><a href="{{ route('early-access-backend') }}"><i data-feather="sliders"></i> <span class="tip">Backend</span></a></li>
                {% endif %}
                <li><a href="{{ route('logout') }}"><i data-feather="log-out"></i> <span class="tip">Log out</span></a></li>
            {% else %}
                <li><a href="{{ route('auth') }}"><i data-feather="log-in"></i> Log in / Register</a></li>
            {% endif %}
        </ul>
    </nav>
{% endblock %}

{% block _body %}
    <div class="container">
        {{ macros.messages(flash) }}
    </div>

    <main>
        {% if h1 %}
            <h1>{{ h1 }}</h1>
        {% endif %}
        {% if subtitle %}
            <p>{{ subtitle }}</p>
        {% endif %}

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

{% block footer %}{{ app.name }} v{{ app_version }} - all rights reserved.{% endblock %}