{# Swappable results region: the table/card rows and the pagination footer.
Included by media.html on initial load; returned standalone for htmx page
turns (HX-Request). The surrounding form, action bar, and sort toolbar live
outside this partial and are not replaced on page turn.
Macros below are defined here (not just imported from media.html) so the
partial renders correctly when returned standalone for htmx requests. When
included from media.html the outer definitions shadow these, which is fine. #}
{% from "fragments/_chips.html" import chip, needs_review_chip %}
{% macro media_status(row) %}
{%- if row.latest_run_id -%}
{%- if row.unresolved_count -%}
{{ needs_review_chip(row.unresolved_count) }}
{%- elif row.latest_run_status == "completed" -%}
{{ chip("reviewed") }}
{%- else -%}
{{ chip(humanize_status(row.latest_run_status)) }}
{%- endif -%}
{%- else -%}—{%- endif -%}
{% endmacro %}
{% macro file_missing_notice(row) %}
{%- if row.id in missing_file_ids -%}
Original file not found
{{ row.current_path or row.source_path }}
{%- endif -%}
{% endmacro %}
{% macro row_action(row) %}
{%- if row.latest_run_id -%}
{%- if row.latest_run_status == "awaiting_adjudication" -%}
Review →
{%- elif row.latest_run_status == "failed" -%}
Retry →
{%- else -%}
Open →
{%- endif -%}
{%- endif -%}
{% endmacro %}
{% set filter_qs %}{% if search %}&q={{ search|urlencode }}{% endif %}{% if status %}&status={{ status }}{% endif %}{% endset %}
{% macro media_card(row) %}