LeagueStats/client/src/views/SummonerRecords.vue

197 lines
5.4 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="mx-4 text-2xl text-blue-200 border-b-2 border-blue-800 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="text-blue-400"
property="kda"
:record="records.maxKda"
title="best kda"
/>
<RecordCard
color="text-green-400"
property="kills"
:record="records.maxKills"
title="most kills"
/>
<RecordCard
color="text-blue-500"
property="assists"
:record="records.maxAssists"
title="most assists"
/>
<RecordCard
color="text-red-500"
property="deaths"
:record="records.maxDeaths"
title="most deaths"
/>
<RecordCard
color="text-yellow-600"
property="gold"
:record="records.maxGold"
title="most gold earned"
/>
<RecordCard
color="text-white"
property="time"
:record="records.maxTime"
title="longest game"
/>
<RecordCard
color="text-pink-500"
property="minions"
:record="records.maxMinions"
title="most minions killed"
/>
</template>
<template v-else>
<div
v-for="index in 7"
:key="index"
style="width: 288px; height: 146px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="146"
:width="288"
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
2020-02-01 19:17:14 +00:00
<rect x="0" y="0" rx="8" ry="8" width="288" height="146" />
</content-loader>
</div>
</template>
</div>
<div class="mx-4 mt-3 text-2xl text-blue-200 border-b-2 border-blue-800 blue-900">game impact</div>
<div class="flex flex-wrap -mx-2">
2020-02-01 19:17:14 +00:00
<template v-if="recordsLoaded">
<RecordCard
color="text-yellow-400"
property="dmgTaken"
:record="records.maxDmgTaken"
title="highest damage taken"
/>
<RecordCard
color="text-red-400"
property="dmgChamp"
:record="records.maxDmgChamp"
title="highest damage to champions"
/>
<RecordCard
color="text-yellow-400"
property="dmgObj"
:record="records.maxDmgObj"
title="highest damage to objectives"
/>
<RecordCard
color="text-green-400"
property="kp"
:record="records.maxKp"
title="highest kill participation"
/>
</template>
<template v-else>
<div
v-for="index in 4"
:key="index"
style="width: 288px; height: 146px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="146"
:width="288"
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
2020-02-01 19:17:14 +00:00
<rect x="0" y="0" rx="8" ry="8" width="288" height="146" />
</content-loader>
</div>
</template>
</div>
<div class="mx-4 mt-3 text-2xl text-blue-200 border-b-2 border-blue-800 blue-900">team work</div>
<div class="flex flex-wrap -mx-2">
2020-02-01 19:17:14 +00:00
<template v-if="recordsLoaded">
<RecordCard
color="text-blue-500"
property="vision"
:record="records.maxVision"
title="highest vision score"
/>
</template>
<template v-else>
<div
v-for="index in 1"
:key="index"
style="width: 288px; height: 146px;"
class="mx-2 mt-6"
2020-02-01 19:17:14 +00:00
>
<content-loader
:height="146"
:width="288"
:speed="2"
primary-color="#17314f"
secondary-color="#2b6cb0"
2020-01-12 00:31:28 +00:00
>
2020-02-01 19:17:14 +00:00
<rect x="0" y="0" rx="8" ry="8" width="288" height="146" />
</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']),
}
}
</script>