Compare commits
3 Commits
50837411d3
...
fdca3e37d1
Author | SHA1 | Date | |
---|---|---|---|
fdca3e37d1 | |||
d2463fd1f3 | |||
854756c5dd |
@ -3,15 +3,16 @@ import Chart from "chart.js/auto"
|
|||||||
const ChampionWinRate = {
|
const ChampionWinRate = {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.handleEvent("win-rate", ({ winRates }) => {
|
this.handleEvent("win-rate", ({ winRates }) => {
|
||||||
patches = winRates.map((winRate) => {
|
this.patches = winRates.map((winRate) => {
|
||||||
return winRate.patch_number
|
return winRate.patch_number
|
||||||
})
|
})
|
||||||
winRateValues = winRates.map((winRate) => winRate.win_rate)
|
this.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: patches,
|
labels: this.patches,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
data: winRateValues,
|
data: this.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" alt="champion-icon" />
|
<img src={@image} class="champion-avatar rounded-xl" 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 src={item.image} />
|
<img class="rounded-xl" 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 src={spell.image} />
|
<img class="rounded-xl" 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,9 +114,6 @@ 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} ->
|
||||||
@ -151,6 +148,8 @@ 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">
|
<div class="win-rate-container" style="position: relative; height:250px; width:400px">
|
||||||
<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