{% extends "base.html" %}

{% block style %}
<style>
  .person {
    display: flex;
    align-items: top;
    margin-bottom: 10px;
  }

  .info {
    flex: 1; /* Allow text to take remaining space */
    padding-right: 10px; /* Add spacing between text and image */
  }

  img.photo {
    max-width: 120px; /* Set max width for images */
    height: auto; /* Maintain image aspect ratio */
  }
</style>


</style>
{% endblock %}

{% set show_images = False %}

{% block title %}Conference archive{% endblock %}

  {% block content %}
  <div>

  {% if show_images %}

  <div class="left-images">
  {% for person, photo in left_photos %}
  <div class="image-container" id="image-{{person.id}}">
     <a href="{{ url_for("person", person_id=person.id) }}">
       <img class="image" src="{{ url_for("static", filename=photo) }}" alt="{{ person.name}}" title="{{ person.name}}">
    </a>
  </div>
  {% endfor %}
  </div>

  <div class="right-images">
  {% for person, photo in right_photos %}
  <div class="image-container">
     <a href="{{ url_for("person", person_id=person.id) }}">
       <img id="image-{{person.id}}" class="image" src="{{ url_for("static", filename=photo) }}" alt="{{ person.name}}" title="{{ person.name}}">
    </a>
  </div>
  {% endfor %}

  </div>
  {% endif %}


    <h1>Conference archive</h1>

    <form action="{{ url_for("search_people") }}">
      <div class="mb-3">
        <label for="q" class="form-label">speaker name</label>
        <input type="text" class="form-control" name="q" id="q">
      </div>
      <button type="submit" class="btn btn-primary">Search</button>
    </form>

    <h3>Speaker/conference frequency distribution</h3>

    <p>Distribution of speakers by conference count.</p>
    {% for conf_count, speaker_count in speaker_counts %}
    <div>
      {{ plural(conf_count, "conference") }}:
      {{ plural(speaker_count, "speaker") }}
    </div>
    {% endfor %}

    <h3>Top speakers</h3>
    <ul>

    {% for person, count in top_speakers %}
    {% if loop.first or loop.previtem[1] != count %}
    <h4>{{ count }} conferences</h4>
    {% endif %}
    <div class="person">
      {% set photo = person.photo_filename() %}
      <span class="info" id="person-{{ person.id }}">
      👤
      <a href="{{ url_for("person", person_id=person.id) }}">{{ person.name }}</a><br>
      ({{ count }} conferences, {{ person.event_count }} talks)
      {% if person.photo_filename() %}📷{% endif %}
      {% if person.wikidata_qid %}
      <a href="https://www.wikidata.org/wiki/{{ person.wikidata_qid }}">Wikidata</a>
      {% endif %}
      </span>
      {% if photo %}
      <img class="photo" src="{{ url_for("static", filename=photo) }}" alt="{{ person.name }}">
      {% endif %}
    </div>
    {% endfor %}

</div>
{% endblock %}