dawarich/app/views/shared/_right_sidebar.html.erb
2024-07-24 20:25:16 +02:00

64 lines
2.3 KiB
Text

<%= sidebar_distance(@distance) %> <%= sidebar_points(@points) %>
<div id='years-nav'>
<div class="dropdown">
<div tabindex="0" role="button" class="btn m-1">Select year</div>
<ul tabindex="0" class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52">
<% current_user.stats.years.each do |year| %>
<li><%= link_to year, map_url(year_timespan(year).merge(year: year)) %></li>
<% end %>
</ul>
</div>
<% @years.each do |year| %>
<h3 class='text-xl'>
<%= year %>
</h3>
<div class='grid grid-cols-3 gap-3'>
<% (1..12).to_a.each_slice(3) do |months| %>
<% months.each do |month_number| %>
<% if past?(year, month_number) && points_exist?(year, month_number, current_user) %>
<%= link_to Date::ABBR_MONTHNAMES[month_number], map_url(timespan(month_number, year)), class: 'btn btn-default' %>
<% else %>
<div class='btn btn-disabled'><%= Date::ABBR_MONTHNAMES[month_number] %></div>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
</div>
<% if REVERSE_GEOCODING_ENABLED && @countries_and_cities&.any? %>
<hr class='my-5'>
<h2 class='text-lg font-semibold'>Countries and cities</h2>
<% @countries_and_cities.each do |country| %>
<% next if country[:cities].empty? %>
<h2 class="text-lg font-semibold mt-5">
<%= country[:country] %> (<%= country[:cities].count %> cities)
</h2>
<ul class="timeline timeline-vertical">
<% country[:cities].each do |city| %>
<li>
<hr />
<div class="timeline-start"><%= link_to_date(city[:timestamp]) %></div>
<div class="timeline-middle">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="h-5 w-5">
<path
fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
clip-rule="evenodd" />
</svg>
</div>
<div class="timeline-end timeline-box"><%= city[:city] %></div>
<hr />
</li>
<% end %>
</ul>
<% end %>
<% end %>