feat: show time until pop cooldown ends
This commit is contained in:
parent
9ff401bdfd
commit
cee4129e65
3 changed files with 40 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
<main id="nm-list">
|
||||
<% APP_DATA[instance.zone.to_sym][:nms].each do |nm| %>
|
||||
<% is_popped = instance.pops.any? { |pop| pop.name == nm[:name].parameterize } %>
|
||||
<% is_popped = instance.pops.filter { |pop| (Time.current - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize } %>
|
||||
<section class="<%= class_names(popped: is_popped) %>">
|
||||
<div>
|
||||
<img src="<%= "/#{nm[:element]}.png" %>" alt="<%= nm[:element] %>" width="30" />
|
||||
|
@ -23,10 +23,18 @@
|
|||
<img src="/<%= nm[:spawned_by][:weather] %>.png" title="during <%= nm[:spawned_by][:weather] %> only" width="15" />
|
||||
<% end %>
|
||||
<small class="badge">LV<%= nm[:spawned_by][:level].to_s.rjust(2, "0") %></small>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div>
|
||||
<% if is_popped %>
|
||||
<% pop = instance.pops.find { |pop| pop.name == nm[:name].parameterize } %>
|
||||
<% mins = ActiveSupport::Duration.build(Time.current - pop.created_at) %>
|
||||
» <%= (120.minutes - mins).in_minutes.floor %>m
|
||||
<span class="progress-container">
|
||||
<span class="progress-bar" style="width: <%= (mins.in_minutes / 120) * 100 %>%"></span>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="button">
|
||||
<% if is_popped %>
|
||||
<button
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue