feat: display the current ET

This commit is contained in:
insects 2025-03-11 15:19:32 +01:00
parent 705e7b1dc0
commit 6710137d9b
4 changed files with 23 additions and 9 deletions

View file

@ -1,5 +1,5 @@
<div id="public_id" data-content="<%= @instance.public_id %>"></div>
<div hx-get="" hx-trigger="every 30s" hx-swap="innerHTML" hx-select="#nm-list" hx-target="#nm-list">
<div hx-get="" hx-trigger="every 15s" hx-swap="outerHTML" hx-select="#container" hx-target="#container">
<header>
<div class="title">
<%= link_to root_path do %><img src="/icon.png" width="50" alt="eureka.coffee logo" /><% end %>
@ -22,21 +22,21 @@
</div>
</header>
<main>
<%= render partial: "list", locals: { instance: @instance } %>
<main id="container">
<%= render partial: "list", locals: { instance: @instance, forecast: @forecast } %>
<div class="sidebar">
<div class="time">ET <%= Clock.display_ez_time(Clock.get_current_eorzea_time) %></div>
<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] %>" />
<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>
<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>