LeagueStats/client/src/views/SummonerRecords.vue

238 lines
6.5 KiB
Vue
Raw Normal View History

2020-01-12 00:31:28 +00:00
<template>
2020-02-01 19:17:14 +00:00
<div key="records">
2020-01-12 00:31:28 +00:00
<template v-if="!recordsLoaded || (recordsLoaded && records.maxKda)">
<div
class="relative pl-6 text-2xl text-blue-200 border-b-2 border-blue-800 category blue-900"
>Basics</div>
<div class="flex flex-wrap -mx-2">
2020-02-01 19:17:14 +00:00
<template v-if="recordsLoaded">
<RecordCard
color="#63b3ed"
text-color="text-blue-400"
border-color="border-blue-400"
2020-02-01 19:17:14 +00:00
property="kda"
:record="records.maxKda"
title="KDA"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#68D391"
text-color="text-green-400"
border-color="border-green-400"
2020-02-01 19:17:14 +00:00
property="kills"
:record="records.maxKills"
title="Kills"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#9F7AEA"
text-color="text-purple-500"
border-color="border-purple-500"
2020-02-01 19:17:14 +00:00
property="assists"
:record="records.maxAssists"
title="Assists"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#F56565"
text-color="text-red-500"
border-color="border-red-500"
2020-02-01 19:17:14 +00:00
property="deaths"
:record="records.maxDeaths"
title="Deaths"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#D69E2E"
text-color="text-yellow-600"
border-color="border-yellow-600"
2020-02-01 19:17:14 +00:00
property="gold"
:record="records.maxGold"
title="Gold earned"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#81E6D9"
text-color="text-teal-300"
border-color="border-teal-300"
2020-02-01 19:17:14 +00:00
property="minions"
:record="records.maxMinions"
title="Minions killed"
2020-02-01 19:17:14 +00:00
/>
</template>
<template v-else>
<div
v-for="index in 6"
2020-02-01 19:17:14 +00:00
:key="index"
style="width: 176px; height: 294px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="294"
:width="176"
2020-02-01 19:17:14 +00:00
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
<rect x="0" y="0" rx="8" ry="8" width="176" height="294" />
2020-02-01 19:17:14 +00:00
</content-loader>
</div>
</template>
</div>
<div class="relative pl-6 mt-3 text-2xl text-blue-200 border-b-2 border-blue-800 blue-900 category">Game impact</div>
<div class="flex flex-wrap -mx-2">
2020-02-01 19:17:14 +00:00
<template v-if="recordsLoaded">
<RecordCard
color="#FC8181"
text-color="text-red-400"
border-color="border-red-400"
2020-02-01 19:17:14 +00:00
property="dmgChamp"
:record="records.maxDmgChamp"
title="Damage champions"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#D69E2E"
text-color="text-yellow-400"
border-color="border-yellow-400"
2020-02-01 19:17:14 +00:00
property="dmgObj"
:record="records.maxDmgObj"
title="Damage objectives"
/>
<RecordCard
color="#FC8181"
text-color="text-red-400"
border-color="border-red-400"
property="dmgTaken"
:record="records.maxDmgTaken"
title="Damage taken"
2020-02-01 19:17:14 +00:00
/>
<RecordCard
color="#68D391"
text-color="text-green-400"
border-color="border-green-400"
2020-02-01 19:17:14 +00:00
property="kp"
:record="records.maxKp"
title="Kill participation"
2020-02-01 19:17:14 +00:00
/>
</template>
<template v-else>
<div
v-for="index in 4"
:key="index"
style="width: 176px; height: 294px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="294"
:width="176"
2020-02-01 19:17:14 +00:00
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
<rect x="0" y="0" rx="8" ry="8" width="176" height="294" />
2020-02-01 19:17:14 +00:00
</content-loader>
</div>
</template>
</div>
<div class="relative pl-6 mt-3 text-2xl text-blue-200 border-b-2 border-blue-800 category">Extra</div>
<div class="flex flex-wrap -mx-2">
2020-02-01 19:17:14 +00:00
<template v-if="recordsLoaded">
<RecordCard
color="#D69E2E"
text-color="text-yellow-400"
border-color="border-yellow-400"
2020-02-01 19:17:14 +00:00
property="vision"
:record="records.maxVision"
title="Vision score"
/>
<RecordCard
color="#4299E1"
text-color="text-blue-500"
border-color="border-blue-500"
property="time"
:record="records.maxTime"
title="Longest game"
2020-02-01 19:17:14 +00:00
/>
</template>
<template v-else>
<div
v-for="index in 2"
2020-02-01 19:17:14 +00:00
:key="index"
style="width: 176px; height: 294px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="294"
:width="176"
2020-02-01 19:17:14 +00:00
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
<rect x="0" y="0" rx="8" ry="8" width="176" height="294" />
2020-02-01 19:17:14 +00:00
</content-loader>
</div>
</template>
2020-01-12 00:31:28 +00:00
</div>
</template>
<template v-if="recordsLoaded && !records.maxKda">
<div class="flex flex-col items-center mt-4">
2020-01-12 00:31:28 +00:00
<div>No records have been found.</div>
<div>😕</div>
</div>
</template>
</div>
</template>
<script>
import { mapActions, mapGetters, mapState } from 'vuex'
import { ContentLoader } from 'vue-content-loader'
import RecordCard from '@/components/Summoner/Records/RecordCard.vue'
export default {
components: {
ContentLoader,
RecordCard,
},
computed: {
...mapGetters('summoner', ['summonerFound']),
...mapState({
records: state => state.summoner.records.list,
recordsLoaded: state => state.summoner.records.recordsLoaded,
})
},
watch: {
2020-02-01 19:17:14 +00:00
recordsLoaded() {
this.fetchData()
},
2020-01-12 00:31:28 +00:00
summonerFound() {
this.fetchData()
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
if (!this.recordsLoaded && this.summonerFound) {
this.recordsRequest()
}
},
...mapActions('summoner', ['recordsRequest']),
},
metaInfo() {
return {
title: 'Summoner Records',
}
2020-01-12 00:31:28 +00:00
}
}
</script>
<style scoped>
.category:before {
@apply w-2 h-2 bg-blue-200 absolute block left-0 ml-1;
content: "";
top: 35%;
transform: rotate(45deg);
}
</style>