{% extends "user/dashboard.html" %}

{% set group_type = h.default_group_type('group') %}

{% block page_primary_action %}
  {% if h.check_access('group_create') %}
    {% link_for h.humanize_entity_type('group', group_type, 'add link') or _('Add Group'), named_route=group_type ~ '.new', class_="btn btn-primary", icon="plus-square" %}
  {% endif %}
{% endblock %}

{% block page_heading %}
  <h1 class="mt-3 mt-md-0">{{ h.humanize_entity_type('group', group_type, 'my label') or _('My Groups') }}</h1>
{% endblock %}

{% block primary_content_inner %}
  {% set groups = h.groups_available(am_member=True,
    include_dataset_count=True,
    include_member_count=True) %}
  {% if groups %}
    <div class="wide">
      {% snippet "group/snippets/group_list.html", groups=groups, show_capacity=True %}
    </div>
  {% else %}
    <p class="empty">
      {{ h.humanize_entity_type('group', group_type, 'you not member') or _('You are not a member of any groups.') }}
      {% if h.check_access('group_create') %}
        {% link_for _('Create one now?'), named_route=group_type ~ '.new' %}
      {% endif %}
    </p>
  {% endif %}
{% endblock %}
