summaryrefslogtreecommitdiff
path: root/app/views/pokedex
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/pokedex')
-rw-r--r--app/views/pokedex/show.html.erb20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/views/pokedex/show.html.erb b/app/views/pokedex/show.html.erb
index e463d58..992c7c8 100644
--- a/app/views/pokedex/show.html.erb
+++ b/app/views/pokedex/show.html.erb
@@ -1,11 +1,27 @@
<div class="space-y-4">
<h1>Pokédex</h1>
+ <div class="flex space-x-4 items-center">
+ <%= form_with url: pokedex_path do |f| %>
+ <%= f.collection_select :user_id, User.order(:name), :id,
+ ->(user) { user.name || "No. #{user.id}" }, {selected: params[:user_id], include_blank: "Show full Pokédex"}
+ %>
+ <% end %>
+ <% if @user %>
+ <span>has captured <%= pluralize(@user.captured_pokemon.count, "specie") %> of pokémon.</span>
+ <% end %>
+ </div>
+
<div class="flex flex-wrap gap-4">
<% Pokemon.order(:pokedex_num).each do |pokemon| %>
<% break if pokemon.pokedex_num.to_i > 386 # Up through gen 3. %>
- <div class="flex flex-col flex-auto items-center w-[100px] bg-white
- border border-orange-900 rounded shadow">
+ <div class="flex flex-col flex-auto items-center p-1 w-[100px] bg-white border border-orange-900 rounded shadow
+ <% if @user && !@user.captured_pokemon.include?(pokemon) %>
+ grayscale opacity-50
+ <% else %>
+ ring ring-orange-500 ring-opacity-50
+ <% end %>
+ ">
<div class="flex-1 text-display text-center">No. <%= pokemon.pokedex_num %></div>
<div class="flex-grow flex flex-col justify-around">
<%= image_tag pokemon.sprite_path %>