diff --git a/lib/cobblemon_ui_web/live/battle_components.ex b/lib/cobblemon_ui_web/live/battle_components.ex index 7a1b5c1..a739a21 100644 --- a/lib/cobblemon_ui_web/live/battle_components.ex +++ b/lib/cobblemon_ui_web/live/battle_components.ex @@ -1,8 +1,11 @@ defmodule CobblemonUiWeb.BattleComponents do use CobblemonUiWeb, :html + import CobblemonUiWeb.PokemonComponents, only: [tier_badge: 1] + attr :battle, :map, required: true attr :player_id, :string, required: true + attr :tier_list, :map, default: %{} def battle_panel(assigns) do ~H""" @@ -25,7 +28,7 @@ defmodule CobblemonUiWeb.BattleComponents do else: "border-warning/25 bg-warning/5" ) ]}> -
+
<%= for poke <- actor.active_pokemon do %> + <% tier = Map.get(@tier_list, String.downcase(poke.species || ""), nil) %>
-
-
- {poke.species} - - Lv.{poke.level} - +
+ <%!-- Sprite --%> +
+ {poke.species} +
+ <%!-- Info --%> +
+
+ {poke.species} + + Lv.{poke.level} + + <.tier_badge :if={tier} tier={tier} species={poke.species} compact={true} /> +
+
+ HP + + {poke.hp}/{poke.max_hp} + +
+
+
"bg-base-content/20" + poke.hp / poke.max_hp > 0.5 -> "bg-success" + poke.hp / poke.max_hp > 0.2 -> "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}%"} + /> +
- - {poke.hp}/{poke.max_hp} - -
-
-
"bg-base-content/20" - poke.hp / poke.max_hp > 0.5 -> "bg-success" - poke.hp / poke.max_hp > 0.2 -> "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}%"} - />
<% end %> diff --git a/lib/cobblemon_ui_web/live/dashboard_live.ex b/lib/cobblemon_ui_web/live/dashboard_live.ex index 93081f0..9271fb8 100644 --- a/lib/cobblemon_ui_web/live/dashboard_live.ex +++ b/lib/cobblemon_ui_web/live/dashboard_live.ex @@ -217,7 +217,7 @@ defmodule CobblemonUiWeb.DashboardLive do
<%!-- Active battle --%> - <.battle_panel :if={@battle} battle={@battle} player_id={@selected_player} /> + <.battle_panel :if={@battle} battle={@battle} player_id={@selected_player} tier_list={@tier_list} /> <%!-- View mode tabs --%>