{# Play and pause are one button: panel.css shows whichever glyph the
.playing class calls for. A room's drives its Spotify stream, the AVR's
the film on the Zidoo plugged into it. #}
{% macro play_button(role, label) -%}
{%- endmacro %}
{% macro host_toggle() -%}
{%- endmacro %}
{# The Spotify resume buttons with the host toggle in the middle of them. #}
{% macro control_row(target, accounts) -%}
{% set split = (accounts | length + 1) // 2 %}
{% for account in accounts %}
{% if loop.index0 == split %}{{ host_toggle() }}{% endif %}
{% endfor %}
{# Fewer accounts than the midpoint means the loop never reached it. #}
{% if accounts | length <= split %}{{ host_toggle() }}{% endif %}
{% if not avr %}
{% endif %}
{{ play_button('play', room.label) }}
{% if not avr %}
{% endif %}
{% if avr %}
{% else %}
{{ control_row(room.key, accounts) }}
{# Folded until asked for, and only filled in then: see paintQueue. #}
Up next
{% endif %}
{%- endmacro %}
{% for room in rooms %}
{{ room_card(room, spotify_accounts) }}
{% endfor %}