{% import "macros.twig" as helper %}
{% set current = current is defined ? current : 'demo' %}
{% set showForm = showForm|default(false) %}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
        <title>KeyLighter</title>

        {{ encore_entry_link_tags('app') }}

        <link rel="stylesheet" href="{{ url('keylighter_stylesheet') }}" />
        <link rel="icon" href="{{ asset('img/favicon.png') }}"/>
    </head>
    <body>
        <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
            <div class="container">
                <a class="navbar-brand" href="{{ url('homepage') }}">
                    <img src="{{ asset('img/logo.png') }}" alt="KeyLighter" class="d-inline-block align-top"/>
                </a>

                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <div class="collapse navbar-collapse right" id="navbarSupportedContent">
                    <ul class="navbar-nav ml-auto">
                        <li class="nav-item {% if showForm %}visible active{% endif %}" data-toggle="form" data-id="try-form" id="form-toggle">
                            <a href="#try-form" class="nav-link slim"><i class="{{ fa('chevron-down', 'solid') }}"></i></a>
                        </li>
                        {{ helper.menu_entry('https://github.com/kadet1090/keylighter', 'GitHub', fa('github', 'brand'), current == 'github') }}
                        {{ helper.menu_entry(url('changelog'), 'Changelog', fa('history'), current == 'changelog') }}
                        {{ helper.menu_entry(url('documentation_show'), 'Docs', fa('book'), current == 'docs') }}
                        {{ helper.menu_entry(url('homepage'), 'About', fa('info'), current == 'about') }}
                    </ul>
                </div>
            </div>
        </nav>

        <div id="try-form" class="{{ showForm ? 'visible' : 'hidden' }}">
            <div class="container">
                {% include 'demo/_form.html.twig' %}
            </div>
        </div>

        <div class="container" id="content">
            {% block content '' %}
        </div>

        <footer id="footer">
            <div class="container d-flex">
                <div class="d-flex align-items-center">
                    <span style="margin-right: .5rem">KeyLighter</span>
                    <div class="dropup">
                        <button class="btn btn-primary dropdown-toggle btn-sm" type="button" title="Change KeyLighter version" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            {{ versioner.current }}
                        </button>
                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                            {% for version, hash in versioner.installedInfo %}
                                <a class="dropdown-item" href="?keylighter={{ version }}" title="{{ hash }}">{{ version }}</a>
                            {% endfor %}
                        </div>
                    </div>
                </div>
                <div class="copyright">
                    <a href="https://kadet.net"><img src="{{ asset('img/kadet.png') }}" alt="kadet.net logo" class="mx-1"/></a>
                    <span>&copy; {{ 'now'|date('Y') }}</span>
                </div>
            </div>
        </footer>

        {% block modals '' %}

        {{ encore_entry_script_tags('app') }}
        {% block scripts '' %}
    </body>
</html>
