2019-03-30 22:55:48 +00:00
|
|
|
<template>
|
2020-08-12 12:21:14 +00:00
|
|
|
<div
|
|
|
|
|
v-if="overviewLoaded"
|
|
|
|
|
key="overview"
|
|
|
|
|
class="relative flex items-start justify-between mt-3 text-center vue-sticky-container"
|
|
|
|
|
>
|
|
|
|
|
<VueStickySidebar
|
|
|
|
|
:top-spacing="48"
|
|
|
|
|
:bottom-spacing="123"
|
2020-08-12 14:49:47 +00:00
|
|
|
class="z-40 sidebar"
|
2020-08-12 12:21:14 +00:00
|
|
|
container-selector=".vue-sticky-container"
|
|
|
|
|
>
|
2019-12-03 20:57:52 +00:00
|
|
|
<SummonerChampions />
|
|
|
|
|
<SummonerStats />
|
|
|
|
|
<SummonerMates />
|
2020-08-12 12:21:14 +00:00
|
|
|
</VueStickySidebar>
|
|
|
|
|
<div class="w-9/12">
|
2020-02-13 19:16:13 +00:00
|
|
|
<div v-if="current && current.participants" class="mb-4">
|
2020-01-03 21:50:09 +00:00
|
|
|
<LiveMatch />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="overview.matches.length">
|
|
|
|
|
<ul>
|
|
|
|
|
<Match
|
|
|
|
|
v-for="(match, index) in overview.matches"
|
|
|
|
|
:key="index"
|
|
|
|
|
:data="overview.matches[index]"
|
2020-02-01 16:14:03 +00:00
|
|
|
:index-match="index"
|
2020-01-03 21:50:09 +00:00
|
|
|
/>
|
|
|
|
|
</ul>
|
|
|
|
|
<LoadingButton
|
|
|
|
|
v-if="moreMatchesToFetch"
|
|
|
|
|
@clicked="moreMatches"
|
|
|
|
|
:loading="matchesLoading"
|
2020-04-22 20:43:30 +00:00
|
|
|
btn-class="block px-4 py-2 mx-auto mt-4 font-semibold bg-blue-800 rounded-md shadow-lg hover:bg-blue-1000"
|
2020-01-03 21:50:09 +00:00
|
|
|
>More matches</LoadingButton>
|
|
|
|
|
</div>
|
2020-06-11 20:37:22 +00:00
|
|
|
<div v-else>
|
|
|
|
|
<div class="flex justify-center">
|
|
|
|
|
<div class="px-4 py-3 text-lg font-bold text-center text-blue-100 rounded-lg bg-gradient">
|
|
|
|
|
<div>No matches found.</div>
|
|
|
|
|
<div>😕</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-09-14 21:19:10 +00:00
|
|
|
</div>
|
2019-03-30 22:55:48 +00:00
|
|
|
</div>
|
2020-01-01 16:04:55 +00:00
|
|
|
<div v-else>
|
|
|
|
|
<OverviewLoader />
|
2019-12-27 21:09:24 +00:00
|
|
|
</div>
|
2019-03-30 22:55:48 +00:00
|
|
|
</template>
|
|
|
|
|
|
2019-12-03 20:57:52 +00:00
|
|
|
|
2019-03-30 22:55:48 +00:00
|
|
|
<script>
|
2019-09-11 20:02:05 +00:00
|
|
|
import { mapState, mapActions, mapGetters } from 'vuex'
|
2020-01-03 21:50:09 +00:00
|
|
|
import LiveMatch from '@/components/Match/LiveMatch.vue'
|
2020-02-13 19:16:13 +00:00
|
|
|
import LoadingButton from '@/components/Form/LoadingButton.vue'
|
2019-11-03 17:49:58 +00:00
|
|
|
import Match from '@/components/Match/Match.vue'
|
2020-01-01 16:04:55 +00:00
|
|
|
import OverviewLoader from '@/components/Summoner/Overview/OverviewLoader.vue'
|
2019-12-03 20:57:52 +00:00
|
|
|
import SummonerChampions from '@/components/Summoner/Overview/SummonerChampions.vue'
|
|
|
|
|
import SummonerMates from '@/components/Summoner/Overview/SummonerMates.vue'
|
|
|
|
|
import SummonerStats from '@/components/Summoner/Overview/SummonerStats.vue'
|
2020-08-12 12:21:14 +00:00
|
|
|
import VueStickySidebar from 'vue-sticky-sidebar'
|
2019-03-30 22:55:48 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2020-01-03 21:50:09 +00:00
|
|
|
LiveMatch,
|
2019-10-06 13:08:24 +00:00
|
|
|
LoadingButton,
|
2019-04-08 20:06:22 +00:00
|
|
|
Match,
|
2020-01-01 16:04:55 +00:00
|
|
|
OverviewLoader,
|
2019-11-24 13:26:27 +00:00
|
|
|
SummonerChampions,
|
2019-10-25 21:09:33 +00:00
|
|
|
SummonerMates,
|
2019-11-08 14:39:56 +00:00
|
|
|
SummonerStats,
|
2020-08-12 12:21:14 +00:00
|
|
|
VueStickySidebar
|
2020-03-19 22:07:12 +00:00
|
|
|
},
|
|
|
|
|
|
2019-04-07 17:44:01 +00:00
|
|
|
computed: {
|
2019-09-08 20:08:49 +00:00
|
|
|
...mapState({
|
2020-01-19 15:18:35 +00:00
|
|
|
current: state => state.summoner.live.match,
|
2019-12-27 17:38:43 +00:00
|
|
|
overview: state => state.summoner.overview
|
2019-09-11 20:02:05 +00:00
|
|
|
}),
|
2019-12-27 21:09:24 +00:00
|
|
|
...mapGetters('summoner', ['matchesLoading', 'moreMatchesToFetch', 'overviewLoaded', 'summonerFound'])
|
2019-12-27 17:38:43 +00:00
|
|
|
},
|
|
|
|
|
|
2019-12-28 19:35:05 +00:00
|
|
|
watch: {
|
2020-02-01 19:17:14 +00:00
|
|
|
overviewLoaded() {
|
2020-03-30 20:09:23 +00:00
|
|
|
this.fetchData()
|
2020-02-01 19:17:14 +00:00
|
|
|
},
|
2019-12-28 19:35:05 +00:00
|
|
|
summonerFound() {
|
|
|
|
|
this.fetchData()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-12-27 17:38:43 +00:00
|
|
|
created() {
|
2019-12-28 19:35:05 +00:00
|
|
|
this.fetchData()
|
2019-08-23 14:48:16 +00:00
|
|
|
},
|
|
|
|
|
|
2019-03-30 22:55:48 +00:00
|
|
|
methods: {
|
2019-12-28 19:35:05 +00:00
|
|
|
fetchData() {
|
2019-12-28 22:49:53 +00:00
|
|
|
if (!this.overviewLoaded && this.summonerFound) {
|
2019-12-28 19:35:05 +00:00
|
|
|
this.overviewRequest()
|
|
|
|
|
}
|
2020-08-12 12:27:45 +00:00
|
|
|
// Keep only the 10 last matches when summoner enters overview page
|
|
|
|
|
else if (this.overviewLoaded && this.summonerFound && this.overview.matches.length !== 10) {
|
|
|
|
|
this.sliceOverviewMatches(10)
|
|
|
|
|
}
|
2019-12-28 19:35:05 +00:00
|
|
|
},
|
2020-08-12 12:27:45 +00:00
|
|
|
...mapActions('summoner', ['moreMatches', 'overviewRequest', 'sliceOverviewMatches']),
|
2019-12-28 19:35:05 +00:00
|
|
|
},
|
2020-06-26 15:27:22 +00:00
|
|
|
|
|
|
|
|
metaInfo() {
|
|
|
|
|
return {
|
|
|
|
|
title: 'Summoner Overview',
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-08-23 14:48:16 +00:00
|
|
|
}
|
2019-03-30 22:55:48 +00:00
|
|
|
</script>
|
2020-03-19 22:07:12 +00:00
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.sidebar {
|
|
|
|
|
width: 300px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|