%# locals: (title:, occurrences:, tone: :default, date_labels: false, suggestions: {}, meta: nil, pay_periods: []) %>
<% return if occurrences.empty? %>
<%# Where two rows would read identically, and only there, the row earns a
second fact to tell them apart (BillsHelper#bills_ambiguous_row_keys).
Adding the schedule to every row instead would be nineteen copies of
something nobody was confused about. %>
<% ambiguous = bills_ambiguous_row_keys(occurrences) %>
<% markers = bills_pay_period_markers(occurrences, pay_periods) %>
">
<%= title %>
·
<%= occurrences.size %>
<% if meta %>
<%= meta %>
<% end %>
<%# The divider is half its old weight: the rows are separated by a hairline
and by the hover state, not by a rule competing with the content. %>
<%# A container query, not a media query. The app shell has two sidebars, so
main is ~420px wide at a 1280px viewport -- "desktop" by any breakpoint
and phone-width in practice. The row has to size itself against the space
it actually has. %>
<% occurrences.each do |occurrence| %>
<%# The marker belongs to the first row of its period, so it lands
between groups without the section having to pre-bucket the rows. %>
<% if (marker = markers[occurrence.id]) %>
<%= render "bills/pay_period_marker",
period: marker[:period],
currency: Current.family.currency,
due_total: marker[:due_total] %>
<% end %>
<%= render "bills/occurrence",
occurrence: occurrence,
date_label: date_labels,
suggestion: suggestions[occurrence.id],
disambiguate: ambiguous.include?([ occurrence.recurring_transaction.display_name, occurrence.resolved_expected_amount ]) %>
<% end %>