2019-11-24 13:26:27 +00:00
|
|
|
<template>
|
|
|
|
|
<div class="bg-blue-800 rounded-lg">
|
|
|
|
|
<div class="relative heading flex items-center justify-center py-4 rounded-t-lg text-blue-200">
|
|
|
|
|
<svg class="w-5 h-5" style="transform: rotate(-5deg);">
|
|
|
|
|
<use xlink:href="#layers" />
|
|
|
|
|
</svg>
|
|
|
|
|
<span class="mx-4 text-lg font-bold uppercase">CHAMPIONS</span>
|
|
|
|
|
<svg class="w-5 h-5" style="transform: rotate(5deg);">
|
|
|
|
|
<use xlink:href="#layers" />
|
|
|
|
|
</svg>
|
|
|
|
|
<div class="absolute right-0 top-0 mt-3 mr-2">
|
2020-02-13 19:16:13 +00:00
|
|
|
<Tooltip>
|
2019-11-24 13:26:27 +00:00
|
|
|
<template v-slot:trigger>
|
|
|
|
|
<svg class="w-4 h-4 cursor-pointer">
|
|
|
|
|
<use xlink:href="#info" />
|
|
|
|
|
</svg>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:default>
|
|
|
|
|
<div class="px-2 text-white text-center text-sm select-none">
|
|
|
|
|
<div>Stats based on</div>
|
|
|
|
|
<div>
|
2020-01-01 15:39:54 +00:00
|
|
|
<span class="text-teal-400 font-bold">{{ stats.global ? stats.global.count : 0 }}</span> matches
|
2019-11-24 13:26:27 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="mt-2 leading-tight text-xs text-blue-100 font-normal italic">
|
|
|
|
|
Load more matches
|
|
|
|
|
<br />to have better results.
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2020-02-13 19:16:13 +00:00
|
|
|
</Tooltip>
|
2019-11-24 13:26:27 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-12-05 20:24:13 +00:00
|
|
|
<div v-if="stats.champion.length">
|
|
|
|
|
<div class="mt-3 px-4 flex items-baseline text-left text-sm text-blue-300 font-bold">
|
|
|
|
|
<div class="ml-2 w-champion text-base text-blue-400">Champion</div>
|
|
|
|
|
<div class="w-plays">plays</div>
|
|
|
|
|
<div class="w-winrate">winrate</div>
|
|
|
|
|
<div class="w-kda">kda</div>
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="mt-1 text-sm text-gray-100 text-left">
|
|
|
|
|
<li
|
|
|
|
|
v-for="(champion, index) in stats.champion"
|
|
|
|
|
:key="index"
|
|
|
|
|
:class="[{'rounded-b-lg': index === stats.champion.length - 1}, {'bg-blue-760': index % 2 === 0}]"
|
|
|
|
|
class="relative flex items-center px-4 py-2 leading-tight"
|
|
|
|
|
>
|
|
|
|
|
<div class="absolute text-xs" style="left: 6px;">{{ index + 1 }}.</div>
|
|
|
|
|
<div class="ml-2 w-champion flex items-center">
|
|
|
|
|
<div
|
|
|
|
|
:style="{backgroundImage: `url('${champion.champion.icon}')`}"
|
|
|
|
|
class="w-8 h-8 bg-center bg-cover bg-blue-1000 rounded-full flex-shrink-0"
|
|
|
|
|
></div>
|
|
|
|
|
<div class="mx-1 truncate">{{ champion.champion.name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="w-plays">
|
|
|
|
|
<div class="text-blue-400 text-xs">{{ champion.count }}</div>
|
|
|
|
|
<div
|
|
|
|
|
:style="{width: widthBar(champion.count, mostPlayed)}"
|
|
|
|
|
class="mt-2px bg-blue-400 rounded-full h-1"
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="w-winrate">
|
|
|
|
|
<div class="text-green-400 text-xs">{{ champion.wins * 100 / champion.count|percent }}</div>
|
|
|
|
|
<div
|
|
|
|
|
:style="{width: widthBar(champion.wins, champion.count)}"
|
|
|
|
|
class="mt-2px bg-green-400 rounded-full h-1"
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="w-kda">
|
|
|
|
|
<div
|
|
|
|
|
class="text-purple-400 text-xs"
|
|
|
|
|
>{{ kda(champion.kills, champion.deaths, champion.assists) }}</div>
|
|
|
|
|
<div
|
|
|
|
|
:style="{width: widthBar(kda(champion.kills, champion.deaths, champion.assists), bestKda)}"
|
|
|
|
|
class="mt-2px bg-purple-400 rounded-full h-1"
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="px-4 py-2">
|
|
|
|
|
<div>No champions have been found.</div>
|
|
|
|
|
<div>😕</div>
|
2019-11-24 13:26:27 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-11-25 20:15:52 +00:00
|
|
|
import { mapState } from 'vuex'
|
2020-02-13 19:16:13 +00:00
|
|
|
import Tooltip from '@/components/Common/Tooltip.vue'
|
2019-11-24 13:26:27 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2020-02-13 19:16:13 +00:00
|
|
|
Tooltip,
|
2019-11-24 13:26:27 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
bestKda() {
|
|
|
|
|
const bestChamp = this.stats.champion.reduce((a, b) => {
|
|
|
|
|
return this.kda(a.kills, a.deaths, a.assists) > this.kda(b.kills, b.deaths, b.assists) ? a : b
|
|
|
|
|
})
|
|
|
|
|
return this.kda(bestChamp.kills, bestChamp.deaths, bestChamp.assists)
|
|
|
|
|
},
|
|
|
|
|
mostPlayed() {
|
|
|
|
|
return this.stats.champion.reduce((a, b) => a.count > b.count ? a : b).count
|
|
|
|
|
},
|
|
|
|
|
...mapState({
|
2019-12-27 17:38:43 +00:00
|
|
|
stats: state => state.summoner.overview.stats
|
2019-11-24 13:26:27 +00:00
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
kda(kills, deaths, assists) {
|
|
|
|
|
return this.$options.filters.round((kills + assists) / deaths)
|
|
|
|
|
},
|
|
|
|
|
widthBar(value, total) {
|
|
|
|
|
return `${value * 36 / total}px`
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.w-champion {
|
|
|
|
|
width: 110px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.w-plays {
|
|
|
|
|
width: 55px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.w-winrate {
|
|
|
|
|
width: 65px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.w-kda {
|
|
|
|
|
width: 36px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|