<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link
            rel="stylesheet"
            href="static/css/bootstrap.min.css"
        />
        <link
            rel="stylesheet"
            href="static/css/font-awesome.min.css"
        />
        <link
            rel="stylesheet"
            href="static/css/custom.css"
        />
        <link rel="icon" href="static/icons/balloon-heart.svg" type="image/x-icon" class="brand-icon">
        <title>{% block title %}Matcsh.{% endblock %}</title>
    </head>

    <body>
        <nav class="navbar navbar-expand-md">
            <img src="static/icons/balloon-heart.svg" class="navbar-brand">
            <p class="navbar-text">Matcsh.</p>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar"> <!-- for mobile devices -->
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbar">
                <div class="navbar-nav">
                    {% if user.is_authenticated %} <!-- shows only if user is logged in -->
                    <a class="nav-item nav-link" id="profile" href="/">Profile</a>
                    <a class="nav-item nav-link" id="matchbook" href="/matchbook">Matchbook</a>
                    <a class="nav-item nav-link" id="logout" href="/logout">Logout</a>
                    {% else %}
                    <a class="nav-item nav-link" id="login" href="/login">Login</a>
                    <a class="nav-item nav-link" id="register" href="/register">Register</a>
                    {% endif %}
                </div>
            </div>
        </nav>
        <!-- For Flash Errors to User -->
        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
                {% if category == 'error' %}
                <div class="alert alert-danger alter-dismissable fade show", role="alert">
                    {{ message }}
                    <button type="button" class="close" data-dismiss="alert">
                        <span aria-hidden="true">&times;</span> <!-- fancy button styling-->
                    </button>
                </div>
                {% else %}
                <div class="alert alert-success alter-dismissable fade show", role="alert">
                    {{ message }}
                    <button type="button" class="close" data-dismiss="alert">
                        <span aria-hidden="true">&times;</span> <!-- fancy button styling-->
                    </button>
                </div>
                {% endif %}
            {% endfor %}
        {% endif %}
        {% endwith %}
        <div class="container">
            {% block content %}
            {% endblock %}
        </div>


        <script
            src="static/js/jquery-3.6.0.min.js"
        </script>
        <script
            src="static/js/popper.min.js"
        </script>
        <script
            src="static/js/bootstrap.min.js"
        </script>
    </body>
</html>
