Compare commits
No commits in common. "fdca3e37d1a19a717ccf040ab3a95069241d3c70" and "50837411d3493a9696f6789dc77696405ec3b980" have entirely different histories.
fdca3e37d1
...
50837411d3
@ -3,16 +3,15 @@ import Chart from "chart.js/auto"
|
|||||||
const ChampionWinRate = {
|
const ChampionWinRate = {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.handleEvent("win-rate", ({ winRates }) => {
|
this.handleEvent("win-rate", ({ winRates }) => {
|
||||||
this.patches = winRates.map((winRate) => {
|
patches = winRates.map((winRate) => {
|
||||||
return winRate.patch_number
|
return winRate.patch_number
|
||||||
})
|
})
|
||||||
this.winRateValues = winRates.map((winRate) => winRate.win_rate)
|
winRateValues = winRates.map((winRate) => winRate.win_rate)
|
||||||
// TODO: it breaks on liveview updates, should apply a better fix...
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const data = {
|
const data = {
|
||||||
labels: this.patches,
|
labels: patches,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
data: this.winRateValues,
|
data: winRateValues,
|
||||||
fill: false,
|
fill: false,
|
||||||
borderColor: 'rgb(75, 192, 192)',
|
borderColor: 'rgb(75, 192, 192)',
|
||||||
tension: 0.1
|
tension: 0.1
|
||||||
|
|||||||
@ -16,7 +16,7 @@ defmodule LolAnalyticsWeb.ChampionComponents.ChampionAvatar do
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="flex flex-col w-40">
|
<div class="flex flex-col w-40">
|
||||||
<img src={@image} class="champion-avatar rounded-xl" alt="champion-icon" />
|
<img src={@image} class="champion-avatar" alt="champion-icon" />
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|||||||
@ -9,7 +9,7 @@ defmodule LolAnalyticsWeb.ChampionComponents.Items do
|
|||||||
<%= for item <- assigns.items do %>
|
<%= for item <- assigns.items do %>
|
||||||
<div class="has-tooltip">
|
<div class="has-tooltip">
|
||||||
<div clas="flex flex-col gap-1 p-4">
|
<div clas="flex flex-col gap-1 p-4">
|
||||||
<img class="rounded-xl" src={item.image} />
|
<img src={item.image} />
|
||||||
<%!-- <p><%= item.name %></p> --%>
|
<%!-- <p><%= item.name %></p> --%>
|
||||||
<p><%= item.win_rate %>%</p>
|
<p><%= item.win_rate %>%</p>
|
||||||
<p class="text-xs"><%= item.wins %>/<%= item.total_games %></p>
|
<p class="text-xs"><%= item.wins %>/<%= item.total_games %></p>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ defmodule LolAnalyticsWeb.ChampionComponents.SummonerSpells do
|
|||||||
<%= for spell <- assigns.spells do %>
|
<%= for spell <- assigns.spells do %>
|
||||||
<div class="has-tooltip">
|
<div class="has-tooltip">
|
||||||
<div clas="flex flex-col gap-1">
|
<div clas="flex flex-col gap-1">
|
||||||
<img class="rounded-xl" src={spell.image} />
|
<img src={spell.image} />
|
||||||
<p><%= spell.win_rate %>%</p>
|
<p><%= spell.win_rate %>%</p>
|
||||||
<p class="text-xs"><%= spell.wins %>/<%= spell.total_games %></p>
|
<p class="text-xs"><%= spell.wins %>/<%= spell.total_games %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -114,6 +114,9 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|
|||||||
defp page_title(:show), do: "Show Champion"
|
defp page_title(:show), do: "Show Champion"
|
||||||
defp page_title(:edit), do: "Edit Champion"
|
defp page_title(:edit), do: "Edit Champion"
|
||||||
|
|
||||||
|
def render_summoner_spells(assigns) do
|
||||||
|
end
|
||||||
|
|
||||||
def render_items(assigns) do
|
def render_items(assigns) do
|
||||||
case assigns.items do
|
case assigns.items do
|
||||||
%{status: :loading} ->
|
%{status: :loading} ->
|
||||||
@ -148,8 +151,6 @@ defmodule LoLAnalyticsWeb.ChampionLive.Show do
|
|||||||
case assigns.summoner_pells do
|
case assigns.summoner_pells do
|
||||||
%{status: :loading} ->
|
%{status: :loading} ->
|
||||||
~H"""
|
~H"""
|
||||||
<h2 class="text-2xl">Summoner spells</h2>
|
|
||||||
<div class="my-2" />
|
|
||||||
<.loader />
|
<.loader />
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<.champion_avatar class="w-20" id={@champion.id} name={@champion.name}
|
<.champion_avatar class="w-20" id={@champion.id} name={@champion.name}
|
||||||
image={"https://ddragon.leagueoflegends.com/cdn/14.11.1/img/champion/#{@champion.image}"} />
|
image={"https://ddragon.leagueoflegends.com/cdn/14.11.1/img/champion/#{@champion.image}"} />
|
||||||
<div class="win-rate-container" style="position: relative; height:250px; width:400px">
|
<div class="win-rate-container">
|
||||||
<canvas class="w-full win-rate" height="250" class="win-rate" id="win-rate" phx-hook="ChampionWinRate" />
|
<canvas class="w-full win-rate" height="250" class="win-rate" id="win-rate" phx-hook="ChampionWinRate" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user