<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="mobile-web-app-capable" content="yes">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="theme-color" content="#48C774">
        <link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='images/apple-touch-icon.png') }}">
        <link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='images/favicon-16x16.png') }}">
        <link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='images/favicon-32x32.png') }}">
        <link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
        <link rel="stylesheet" href="{{ url_for('static', filename='css/bulma.css') }}">
        {% block head %}{% endblock %}
        <title>{% block title %}{% endblock %} - Valens</title>
    </head>
    <body class="has-navbar-fixed-top has-navbar-fixed-bottom">
        <nav class="navbar is-fixed-top is-success" role="navigation" aria-label="main navigation">
            <div class="container">
                <div class="navbar-brand">
                    {% if parent_page is defined %}
                    <a href="{{ url_for(parent_page) }}" class="navbar-item has-text-light has-text-weight-bold is-size-5">&#10094;</a>
                    {% else %}
                    <a class="navbar-item has-text-success has-text-weight-bold is-size-5">&#10094;</a>
                    {% endif %}
                    <div class="navbar-item has-text-light has-text-weight-bold is-size-5">
                        {% block content_title %}{% endblock %}
                    </div>
                </div>
                <input type="checkbox" id="navbar-burger-toggle" class="navbar-burger-toggle is-hidden">
                <label for="navbar-burger-toggle" class="navbar-burger">
                    <span></span>
                    <span></span>
                    <span></span>
                </label>
                <div class="navbar-menu">
                    <div class="navbar-end">
                        {% for name, target in navbar_items %}
                        <a class="navbar-item is-size-5 has-text-weight-bold" href="{{ target }}">
                            {{ name }}
                        </a>
                        {% endfor %}
                        {% if 'username' in session %}
                        <div class="navbar-item">
                            <span class="tag is-medium has-text-light has-background-grey has-text-weight-bold">{{ session['username'] }}</span>
                        </div>
                        {% endif %}
                    </div>
                </div>
            </div>
        </nav>
        <div class="container is-max-desktop py-4">
            {% with messages = get_flashed_messages() %}
            {% for message in messages %}
            <div class="message is-danger mx-2">
                <div class="message-body">
                    {{ message }}
                </div>
            </div>
            {% endfor %}
            {% endwith %}
            {% block content %}{% endblock %}
        </div>
    </body>
</html>
