{% extends "base.html" %}

{% block title %}Home{% endblock %}

{% block content %}

<div class="actions">
  <a id="settings" href={{ url_for("settings") }}>Settings</a>
  <form action={{ url_for("capture") }} method="POST">
    <button id="capture">CAPTURE</button>
  </form>
</div>

{% block replay %}
{% endblock %}

<section>
  <h2>Past Replays</h2>

  {% if past_replays | length > 0 %}
    <div>
    {% for pr in past_replays %}
      {% if replay and replay == pr %}
      <span class="past-replay selected">
        {{ pr }}
        <form
          id="delete-replay"
          action={{ url_for("delete_replay") }}
          method="POST"
          onSubmit="return confirm('Do you want to delete this replay forever?');">
          <nobr>(<button name="{{ delete_field }}" value="{{ replay }}">delete</button>)</nobr>
        </form>
      </span>
      {% else %}
      <a class="past-replay" href={{ url_for("replay", replay=pr) }}>
        {{ pr }}
      </a>
      {% endif %}
    {% endfor %}
    </div>
  {% else %}
    <p>No past replay...</p>
  {% endif %}
</section>
{% endblock %}
