{# metrics - flat list of accessible MetricBase instances (kept for compat). groups - list of (MetricGroup, [MetricBase]) tuples, in display order. The first entry is always the favorites group. user_favorites - set of favorited metric names (empty set for anonymous users). #}
{# ── Toolbar ── #}
{% if h.check_access('better_stats_view_settings') %} {{ _('Settings') }} {% endif %}
{# ── Group filter pills ── #}
{% for group, _ in groups %} {% endfor %}
{# ── Group sections ── #} {% for group, group_metrics in groups %}
{% if group.name == 'favorites' %} {# Favorites section: special empty / anon states #} {% if current_user.is_anonymous %}

{{ _('Log in') }} {{ _('to add metrics to your favorites.') }}

{% elif not group_metrics %}

{{ _('No favorites yet — click the') }} {{ _('on any metric to add it here.') }}

{% else %} {% for metric in group_metrics %} {% snippet 'better_stats/metric_card.html', metric=metric, is_favorite=true, content_id_prefix="fav-" %} {% endfor %} {% endif %} {% else %} {% for metric in group_metrics %} {% snippet 'better_stats/metric_card.html', metric=metric, is_favorite=(metric.name in user_favorites) %} {% endfor %} {% endif %}
{% endfor %} {# ── Global empty state ── #}
{# ── Single fullscreen modal (reused for all metrics) ── #}