{% extends "base.html" %}

{% block title %}
{{ _("Community Hub") }} -
{{ _('%(title)s by %(author)s', title=package.title, author=package.author.display_name) }}
{% endblock %}

{% block description -%}
	{{ _('Mods and texture packs for %(title)s', title=package.title) }}
{% endblock %}

{% block headextra %}
	{% if package.get_thumb_url(3, True, "png") %}
		<meta name="og:image" content="{{ package.get_thumb_url(3, True, "png") }}"/>
	{% endif %}
{% endblock %}


{% block content %}
	{% from "macros/packagegridtile.html" import render_pkggrid %}

	<h1 class="mb-5">
		{{ _("Community Hub") }} -
		<a href="{{ package.get_url('packages.view') }}">
			{{ _('%(title)s by %(author)s', title=package.title, author=package.author.display_name) }}
		</a>
	</h1>

	<form action="{{ url_for('packages.list_all') }}" method="GET" class="mb-5">
		<input type="hidden" name="game" value="{{ package.get_id() }}">
		<label for="game-search" class="sr-only">{{ _('Search for packages for %(title)s', title=package.title) }}</label>
		<div class="input-group mb-3">
			<input name="q" id="game-search" type="text" class="form-control"
					placeholder="{{ _('Search for packages for %(title)s', title=package.title) }}">
			<button class="btn btn-primary" type="submit" id="game-search-go" aria-label="{{ _('Search') }}">
				<i class="fas fa-search"></i>
			</button>
		</div>
	</form>

	<a href="{{ url_for('packages.list_all', sort='approved_at', order='desc', game=package.get_id()) }}" class="btn btn-secondary float-end">
		{{ _("See more") }}
	</a>
	<h2 class="my-3">{{ _("Recently Added") }}</h2>
	{{ render_pkggrid(new) }}


	<a href="{{ url_for('packages.list_all', sort='last_release', order='desc', game=package.get_id()) }}" class="btn btn-secondary float-end">
		{{ _("See more") }}
	</a>
	<h2 class="my-3">{{ _("Recently Updated") }}</h2>
	{{ render_pkggrid(updated) }}


	<a href="{{ url_for('packages.list_all', type='mod', sort='score', order='desc', game=package.get_id()) }}" class="btn btn-secondary float-end">
		{{ _("See more") }}
	</a>
	<h2 class="my-3">{{ _("Top Mods") }}</h2>
	{{ render_pkggrid(pop_mod) }}


	<a href="{{ url_for('packages.list_all', type='txp', sort='score', order='desc', game=package.get_id()) }}" class="btn btn-secondary float-end">
		{{ _("See more") }}
	</a>
	<h2 class="my-3">{{ _("Top Texture Packs") }}</h2>
	{{ render_pkggrid(pop_txp) }}


	<a href="{{ url_for('packages.list_all', sort='reviews', order='desc', game=package.get_id()) }}" class="btn btn-secondary float-end">
		{{ _("See more") }}
	</a>
	<h2 class="my-3">{{ _("Highest Reviewed") }}</h2>
	{{ render_pkggrid(high_reviewed) }}

{% endblock %}
