{#
SPDX-FileCopyrightText: 2026 Martin Kirchgessner

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% extends 'layout.jinja' %}
{% block title %}Live{% endblock title %}

{% block content %}
<section>
<div id="livecontent"
    hx-ext="sse"
    sse-connect="{{ url_for("live.get") }}"
    sse-swap="message"
    >

    <span
        id="skipbutton"
        hx-preserve
        class="level-item"
        >
        {% if current_user.user.can_live() %}
            <button
                class="button is-danger"
                hx-delete="{{ url_for('live.skip') }}"
                hx-on::confirm="confirmWithMessage(`Skip current track?`)"
                hx-swap="none"
                >
                Skip
            </button>
        {% endif %}
    </span>

    Waiting for player info...
</div>
</section>

<script>
document.body.addEventListener('htmx:sseError', function (e, lol) {
    document.getElementById("livecontent").innerHTML = "Connection error";
})
</script>

{% endblock content %}

