+ <%= for poke <- actor.active_pokemon do %>
+ <% tier = Map.get(@tier_list, String.downcase(poke.species || ""), nil) %>
+ <% hp_pct = if poke.max_hp > 0, do: Float.round(poke.hp / poke.max_hp * 100, 1), else: 0.0 %>
+
<%!-- Sprite --%>
-
+
<%!-- Info --%>
-
-
{poke.species}
-
+ <%!-- Name row --%>
+
+ {poke.species}
+
Lv.{poke.level}
<.tier_badge :if={tier} tier={tier} species={poke.species} compact={true} />
-
- HP
-
- {poke.hp}/{poke.max_hp}
-
-
-
+ <%!-- HP bar --%>
+
"bg-base-content/20"
- poke.hp / poke.max_hp > 0.5 -> "bg-success"
- poke.hp / poke.max_hp > 0.2 -> "bg-warning"
+ hp_pct > 50 -> "bg-success"
+ hp_pct > 20 -> "bg-warning"
true -> "bg-error"
end
]}
- style={"width: #{if poke.max_hp > 0, do: Float.round(poke.hp / poke.max_hp * 100, 1), else: 0}%"}
+ style={"width: #{hp_pct}%"}
/>
+ <%!-- HP numbers --%>
+
+ HP
+
+ {poke.hp} / {poke.max_hp}
+ ({hp_pct}%)
+
+
-
- <% end %>
+ <% end %>
+
<% end %>
diff --git a/lib/cobblemon_ui_web/live/pokemon_components.ex b/lib/cobblemon_ui_web/live/pokemon_components.ex
index 571d701..9490c9e 100644
--- a/lib/cobblemon_ui_web/live/pokemon_components.ex
+++ b/lib/cobblemon_ui_web/live/pokemon_components.ex
@@ -52,7 +52,7 @@ defmodule CobblemonUiWeb.PokemonComponents do
class={[
"inline-flex items-center justify-center font-black rounded leading-none shrink-0",
"bg-base-300/20 text-base-content/25 ring-1 ring-base-300/30",
- if(@compact, do: "text-[9px] w-4 h-4", else: "text-[10px] w-5 h-5")
+ if(@compact, do: "text-[11px] w-6 h-6", else: "text-sm w-7 h-7")
]}
>
?
@@ -101,7 +101,7 @@ defmodule CobblemonUiWeb.PokemonComponents do
rel="noopener noreferrer"
class={[
"inline-flex items-center justify-center font-black rounded leading-none shrink-0 hover:scale-110 transition-transform",
- if(@compact, do: "text-[9px] w-4 h-4", else: "text-[10px] w-5 h-5"),
+ if(@compact, do: "text-[11px] w-6 h-6", else: "text-sm w-7 h-7"),
case @tier do
"S" -> "bg-red-500/20 text-red-400 ring-1 ring-red-500/30 hover:bg-red-500/30"
"A" -> "bg-orange-500/20 text-orange-400 ring-1 ring-orange-500/30 hover:bg-orange-500/30"