{% extends "users/settings_base.html" %}

{% block title %}
	{{ _("API Tokens | %(username)s", username=user.username) }}
{% endblock %}

{% block pane %}
	<a class="btn btn-primary float-end" href="{{ url_for('api.create_edit_token', username=user.username) }}">{{ _("Create") }}</a>
	<a class="btn btn-secondary me-2 float-end" href="/help/api/">{{ _("API Documentation") }}</a>
	<h2 class="mt-0">{{ _("API Tokens") }}</h2>

	<div class="list-group">
		{% for token in user.tokens %}
			<a class="list-group-item list-group-item-action" href="{{ url_for('api.create_edit_token', username=user.username, id=token.id) }}">
				{% if token.client %}
					<span class="badge bg-info float-end">
						{{ _("Application") }}
					</span>
				{% endif %}
				{{ token.name }}
			</a>
		{% else %}
			<span class="list-group-item">
				<i>{{ _("No tokens created") }}</i>
			</span>
		{% endfor %}
	</div>
{% endblock %}
