diff --git a/apps/lol_analytics/lib/lol_analytics/facts/champion_picked_summoner_spell/repo.ex b/apps/lol_analytics/lib/lol_analytics/facts/champion_picked_summoner_spell/repo.ex
index 6610140..cd6b3e2 100644
--- a/apps/lol_analytics/lib/lol_analytics/facts/champion_picked_summoner_spell/repo.ex
+++ b/apps/lol_analytics/lib/lol_analytics/facts/champion_picked_summoner_spell/repo.ex
@@ -45,13 +45,10 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.Repo do
|> IO.inspect()
end
- @spec get_champion_spells_by_win_rate(String.t()) :: list()
- def get_champion_spells_by_win_rate(championId) do
- end
-
- def get_champion_picked_summoners() do
+ def get_champion_picked_summoners(championId, team_position \\ "MIDDLE") do
query =
from f in Schema,
+ where: f.champion_id == ^championId and f.team_position == ^team_position,
join: c in ChampionSchema,
on: c.champion_id == f.champion_id,
join: s in SummonerSpellSchema,
@@ -70,7 +67,6 @@ defmodule LolAnalytics.Facts.ChampionPickedSummonerSpell.Repo do
metadata: s.metadata,
champion_name: c.name,
champion_id: c.champion_id,
- image: c.image,
team_position: f.team_position,
total_games: count("*")
},
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_avatar.ex b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_avatar.ex
new file mode 100644
index 0000000..d69d1ad
--- /dev/null
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_avatar.ex
@@ -0,0 +1,16 @@
+defmodule LolAnalyticsWeb.ChampionComponents.ChampionAvatar do
+ use Phoenix.Component
+
+ attr :id, :integer, required: true
+ attr :image, :string, required: true
+ attr :name, :string, required: true
+
+ def champion_avatar(assigns) do
+ ~H"""
+
+

+
<%= @name %>
+
+ """
+ end
+end
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_card.ex b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_card.ex
new file mode 100644
index 0000000..4d50cab
--- /dev/null
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/champion_card.ex
@@ -0,0 +1,33 @@
+defmodule LolAnalyticsWeb.ChampionComponents.ChampionCard.Props do
+ defstruct [:id, :win_rate, :image, :name, :team_position, :wins, :total_games]
+end
+
+defmodule LolAnalyticsWeb.ChampionComponents.ChampionCard do
+ use Phoenix.Component
+
+ alias LolAnalyticsWeb.ChampionComponents.ChampionCard.Props
+
+ attr :props, Props, default: %Props{}
+
+ def champion_card(assigns) do
+ ~H"""
+ <.link patch={"/champions/#{@props.id}"}>
+
+

+
+
+
})
+
<%= @props.name %>
+
+
+
+
+ """
+ end
+
+ defp team_position_image("BOTTOM"), do: "/images/lanes/bot.png"
+ defp team_position_image("MIDDLE"), do: "/images/lanes/mid.png"
+ defp team_position_image("TOP"), do: "/images/lanes/top.png"
+ defp team_position_image("JUNGLE"), do: "/images/lanes/jungle.png"
+ defp team_position_image("UTILITY"), do: "/images/lanes/utility.png"
+end
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spell.ex b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spell.ex
new file mode 100644
index 0000000..968582a
--- /dev/null
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spell.ex
@@ -0,0 +1,42 @@
+defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props.SummonerSpell do
+ defstruct [:id, :name, :win_rate, :wins, :total_games, :image]
+
+ @type t :: %{
+ id: integer(),
+ win_rate: float(),
+ wins: integer(),
+ total_games: integer(),
+ image: String.t(),
+ name: String.t()
+ }
+end
+
+defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props do
+ alias LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props.SummonerSpell
+
+ defstruct spell: %SummonerSpell{}
+
+ @type t :: %{spell: SummonerSpell.t()}
+end
+
+defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpell do
+ alias LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props
+ use Phoenix.Component
+
+ attr :spells, Props, default: %Props{}
+
+ def summoner_spells(assigns) do
+ ~H"""
+
+ <%= for spell <- assigns.spells.summoner_spells do %>
+
+

+
<%= spell.spell.name %>
+
<%= spell.spell.win_rate %>%
+
<%= spell.spell.wins %>/<%= spell.spell.total_games %>
+
+ <% end %>
+
+ """
+ end
+end
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spells.ex b/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spells.ex
deleted file mode 100644
index 23e098f..0000000
--- a/apps/lol_analytics_web/lib/lol_analytics_web/components/champion_components/summoner_spells.ex
+++ /dev/null
@@ -1,36 +0,0 @@
-defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.SummonerSpell do
- defstruct [:id, :win_rate, :total_games]
-
- @type t :: %{
- id: integer(),
- win_rate: float(),
- total_games: integer()
- }
-end
-
-defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props do
- alias LolAnalyticsWeb.ChampionComponents.SummonerSpells.SummonerSpell
-
- defstruct spell1: %SummonerSpell{},
- spell2: %SummonerSpell{}
-
- @type t :: %{
- spell1: SummonerSpell.t(),
- spell2: SummonerSpell.t()
- }
-end
-
-defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells do
- alias LolAnalyticsWeb.ChampionComponents.SummonerSpells.Props
- use Phoenix.Component
-
- attr :spells, Props, default: %Props{}
-
- def summoner_spells(assigns) do
- ~H"""
-
- Spells
-
- """
- end
-end
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/core_components.ex b/apps/lol_analytics_web/lib/lol_analytics_web/components/core_components.ex
index 3d50e1e..c2dfb8a 100644
--- a/apps/lol_analytics_web/lib/lol_analytics_web/components/core_components.ex
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/core_components.ex
@@ -302,6 +302,9 @@ defmodule LoLAnalyticsWeb.CoreComponents do
end
def input(%{type: "checkbox"} = assigns) do
+ IO.puts(">>>>")
+ IO.inspect(assigns)
+
assigns =
assign_new(assigns, :checked, fn ->
Phoenix.HTML.Form.normalize_value("checkbox", assigns[:value])
@@ -315,8 +318,8 @@ defmodule LoLAnalyticsWeb.CoreComponents do
type="checkbox"
id={@id}
name={@name}
- value="true"
- checked={@checked}
+ value="false"
+ checked={false}
class="rounded border-zinc-300 text-zinc-900 focus:ring-0"
{@rest}
/>
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/app.html.heex b/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/app.html.heex
index e23bfc8..ab1238b 100644
--- a/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/app.html.heex
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/app.html.heex
@@ -2,25 +2,16 @@
-
- @elixirphoenix
-
-
- GitHub
-
-
- Get Started →
-
+ <.link patch="/champions">
+ Champions
+
@@ -29,4 +20,4 @@
<.flash_group flash={@flash} />
<%= @inner_content %>
-
+
\ No newline at end of file
diff --git a/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/root.html.heex b/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/root.html.heex
index f2a57d3..1d57d7b 100644
--- a/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/root.html.heex
+++ b/apps/lol_analytics_web/lib/lol_analytics_web/components/layouts/root.html.heex
@@ -1,17 +1,20 @@
-
-
-
-
- <.live_title suffix=" · Phoenix Framework">
- <%= assigns[:page_title] || "LoLAnalytics" %>
-
-
-
-
-
- <%= @inner_content %>
-
-
+
+
+
+
+
+ <.live_title suffix=" · Phoenix Framework">
+ <%= assigns[:page_title] || "LoLAnalytics" %>
+
+
+
+
+
+
+ <%= @inner_content %>
+
+
+