feat: add weather forecasting

This commit is contained in:
insects 2025-03-11 14:57:28 +01:00
parent 6eea0dc29f
commit 705e7b1dc0
20 changed files with 181 additions and 19 deletions

View file

@ -22,7 +22,26 @@
</div>
</header>
<%= render partial: "list", locals: { instance: @instance } %>
<main>
<%= render partial: "list", locals: { instance: @instance } %>
<div class="sidebar">
<div class="weather-list">
<% forecast = Weather.forecast(@instance.zone.to_sym) %>
<div class="weather">
<img src="/weather/<%= forecast[0][:curr_weather] %>.png" width="25" title="<%= forecast[0][:weather_name] %>" />
<div>now</div>
</div>
<% 4.times do |i| %>
»
<div class="weather">
<img src="/weather/<%= forecast[i + 1][:curr_weather] %>.png" width="25" title="<%= forecast[i + 1][:weather_name] %>" />
<div><%= ((forecast[i + 1][:time] - Time.now.utc) / 1.minutes).floor %>m</div>
</div>
<% end %>
</div>
</div>
</main>
<%= javascript_include_tag "list" %>
</div>