{% extends "default.html" %}
{%- import 'component/sorting_time.html' as sorting_time -%}

{% block sortnav %}{% endblock %}

{% block content %}
	<pre></pre>
	<div class="d-flex justify-content-between align-items-center">

		<div class="d-flex px-2 align-items-center">
			<div class="text-small font-weight-bold mr-2">‎</div>
			<div class="dropdown dropdown-actions">
				<button class="btn btn-secondary dropdown-toggle" role="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					{% if t=="hour" %}<i class="fas fa-clock mr-1"></i>
					{% elif t=="day" %}<i class="fas fa-calendar-day mr-1"></i>
					{% elif t=="week" %}<i class="fas fa-calendar-week mr-1"></i>
					{% elif t=="month" %}<i class="fas fa-calendar-alt mr-1"></i>
					{% elif t=="year" %}<i class="fas fa-calendar mr-1"></i>
					{% elif t=="all" %}<i class="fas fa-infinity mr-1"></i>
					{% endif %}
				{{t | capitalize}}
				</button>
				<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
					{% if t !="hour" %}<a class="dropdown-item" href="?sort={{sort}}&t=hour"><i class="fas fa-clock mr-2"></i>Hour</a>{% endif %}
					{% if t !="day" %}<a class="dropdown-item" href="?sort={{sort}}&t=day"><i class="fas fa-calendar-day mr-2"></i>Day</a>{% endif %}
					{% if t !="week" %}<a class="dropdown-item" href="?sort={{sort}}&t=week"><i class="fas fa-calendar-week mr-2"></i>Week</a>{% endif %}
					{% if t !="month" %}<a class="dropdown-item" href="?sort={{sort}}&t=month"><i class="fas fa-calendar-alt mr-2"></i>Month</a>{% endif %}
					{% if t !="year" %}<a class="dropdown-item" href="?sort={{sort}}&t=year"><i class="fas fa-calendar mr-2"></i>Year</a>{% endif %}
					{% if t !="all" %}<a class="dropdown-item" href="?sort={{sort}}&t=all"><i class="fas fa-infinity mr-2"></i>All</a>{% endif %}
				</div>
			</div>

			<div class="text-small font-weight-bold ml-3 mr-2">‎</div>
			{{sorting_time.sort_dropdown(sort, t, SORTS_COMMENTS)}}
		</div>
	</div>

	<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}">
		<div class="col-12 px-3">
			<div class="posts" id="posts">
				{% include "comments.html" %}
			</div>
		</div>
	</div>
{% endblock %}

{% block pagenav %}
<nav aria-label="Page navigation">
	<ul class="pagination pagination-sm mb-0">
		{% if page>1 %}
		<li class="page-item">
			<small><a class="page-link" href="?page={{page-1}}&sort={{sort}}&t={{t}}" tabindex="-1">Prev</a></small>
		</li>
		{% else %}
		<li class="page-item disabled"><span class="page-link">Prev</span></li>
		{% endif %}
		{% if next_exists %}
		<li class="page-item">
			<small><a class="page-link" href="?page={{page+1}}&sort={{sort}}&t={{t}}">Next</a></small>
		</li>
		{% else %}
		<li class="page-item disabled"><span class="page-link">Next</span></li>
		{% endif %}
	</ul>
</nav>
{% endblock %}
