<% content_for :title, 'Year-End Digests' %>

<%= icon 'earth' %> Year-End Digests

<% if @available_years.any? && current_user.active? %> <% end %>
<% if @digests.empty? %>

<%= icon 'earth' %>No Year-End Digests Yet

Year-end digests are automatically generated on January 1st each year. <% if @available_years.any? && current_user.active? %>
Or you can manually generate one for a previous year. <% end %>

<% else %>
<% @digests.each do |digest| %>

<%= link_to digest.year, users_digest_path(year: digest.year), class: 'hover:text-primary' %> <% if digest.sharing_enabled? %> Shared <% end %>

Distance
<%= distance_with_unit(digest.distance, current_user.safe_settings.distance_unit) %>
<%= digest.countries_count %>
Countries
<% if digest.first_time_countries.any? %>
<%= icon 'star' %> <%= digest.first_time_countries.count %> new
<% end %>
<%= digest.cities_count %>
Cities
<% if digest.first_time_cities.any? %>
<%= icon 'star' %> <%= digest.first_time_cities.count %> new
<% end %>
<%= link_to users_digest_path(year: digest.year), class: 'btn btn-primary btn-sm' do %> View Details <% end %>
<% end %>
<% end %>