{% extends "components/shell.html" %}

{% from "components/card_list.html" import card_list %}
{% from "components/cards/post.html" import post_card %}
{% from "components/file_hash_search.html" import search_form %}

{% block title %}
  <title>File search results | {{ g.site_name }}</title>
{% endblock title %}

{% block meta %}
  <link rel="canonical" href="{{ g.canonical_url }}">
{% endblock meta %}

{% block content %}
<section class="site-section site-section--file-hash-search">
  {{ search_form() }}

  {% if file_data and file_data.posts  %}
    {% call card_list() %}
      {% for post in file_data.posts %}
        {{ post_card(post) }}
      {% endfor %}
    {% endcall %}
      {% elif  file_data and file_data.discord_posts %} {{ "" }}
  {% else %}
    <div class="no-results">
      <h2 class="site-section__subheading">Nobody here but us chickens!</h2>
      <p class="subtitle">
        There are no posts for your query.
      </p>
    </div>
  {% endif %}
  {% if file_data and file_data.discord_posts  %}
    <h2> Discord </h2>
      {% for post in file_data.discord_posts %}
        <p><a href="{{  "/discord/server/" + post.server +"#"+ post.channel + "-" + post.id }}">Server {{  post.server  }} channel {{ post.channel_name }}</a></p>
      {% endfor %}
  {% endif %}
</section>
{% endblock content %}
