feat: set a page title

This commit is contained in:
insects 2025-03-13 14:49:34 +01:00
parent cdd0933639
commit 2a3fd1fdbe

View file

@ -1,7 +1,11 @@
<div id="nm-list">
<% APP_DATA[instance.zone.to_sym][:nms].each do |nm| %>
<% is_popped = instance.pops.filter { |pop| (Time.now.utc - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize } %>
<section class="<%= class_names(popped: is_popped, missing_reqs: has_missing_reqs?(nm, forecast)) %>">
<% nms_with_popped = APP_DATA[instance.zone.to_sym][:nms].map {|nm|
is_popped = instance.pops.filter { |pop| (Time.now.utc - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize }
{ is_popped: is_popped, **nm }
} %>
<% content_for :title, "#{instance.zone}, #{nms_with_popped.filter { |n| !n[:is_popped] && !has_missing_reqs?(n, forecast) }.count} NMs avail. | eureka.coffee" %>
<% nms_with_popped.each do |nm| %>
<section class="<%= class_names(popped: nm[:is_popped], missing_reqs: has_missing_reqs?(nm, forecast)) %>">
<div>
<img src="<%= "/#{nm[:element]}.png" %>" alt="<%= nm[:element] %>" width="30" />
</div>
@ -29,7 +33,7 @@
</div>
</div>
<div class="condition">
<% if is_popped %>
<% if nm[:is_popped] %>
<div class="pop-timer">
<% pop = instance.pops.find { |pop| pop.name == nm[:name].parameterize } %>
<% mins = ActiveSupport::Duration.build(Time.current - pop.created_at) %>
@ -50,7 +54,7 @@
</div>
<% end %>
<div>
<% if is_popped && has_missing_reqs?(nm, forecast) %>
<% if nm[:is_popped] && has_missing_reqs?(nm, forecast) %>
»
<% end %>
<% if nm[:weather] && forecast[0][:curr_weather] != nm[:weather] %>
@ -67,7 +71,7 @@
</div>
</div>
<div class="action needs_pwd">
<% if is_popped %>
<% if nm[:is_popped] %>
<button
class="action reset"
hx-post="/reset?instance=<%= @instance.public_id %>&nm=<%= nm[:name].parameterize %>"