2019-03-30 22:55:48 +00:00
|
|
|
<template>
|
2019-10-21 12:30:08 +00:00
|
|
|
<div class="bg-blue-900 overflow-hidden min-h-screen flex flex-col">
|
2019-09-14 21:19:10 +00:00
|
|
|
<LazyBackground
|
|
|
|
|
:image-source="require('@/assets/img/bg-homepage-1.jpg')"
|
2019-10-25 21:09:33 +00:00
|
|
|
image-class="absolute w-full h-200 z-0"
|
2019-09-14 21:19:10 +00:00
|
|
|
more-backgrounds="linear-gradient(180deg, rgba(42, 67, 101, 0) 0%, #2A4365 50%),"
|
|
|
|
|
transition-name="fade"
|
|
|
|
|
></LazyBackground>
|
2019-04-10 20:05:52 +00:00
|
|
|
|
2019-10-21 12:30:08 +00:00
|
|
|
<div class="relative page-wrapper mx-auto z-10 flex-grow">
|
2019-10-11 19:43:02 +00:00
|
|
|
<header class="text-teal-100">
|
2019-10-12 13:51:30 +00:00
|
|
|
<div class="flex justify-between items-center">
|
2019-09-14 21:19:10 +00:00
|
|
|
<router-link to="/">
|
2019-10-11 19:43:02 +00:00
|
|
|
<img class="h-24" src="@/assets/img/Logo.svg" alt="LeagueStats logo" />
|
2019-09-14 21:19:10 +00:00
|
|
|
</router-link>
|
2019-08-19 22:08:13 +00:00
|
|
|
|
2019-09-14 21:19:10 +00:00
|
|
|
<SearchForm @formSubmit="redirect" size="small" />
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<template v-if="summonerFound">
|
2019-10-12 13:51:30 +00:00
|
|
|
<div class="mt-4 text-white pb-12">
|
2019-10-12 14:34:05 +00:00
|
|
|
<div class="flex justify-between px-12">
|
2019-09-14 21:19:10 +00:00
|
|
|
<div>
|
2019-10-22 20:59:22 +00:00
|
|
|
<div class="flex items-center">
|
|
|
|
|
<h1 class="text-4xl font-extrabold uppercase">
|
|
|
|
|
<span class="text-5xl">{{ summonerInfos.account.name[0] }}</span>
|
|
|
|
|
<span>{{ summonerInfos.account.name.substring(1) }}</span>
|
|
|
|
|
</h1>
|
|
|
|
|
<div
|
|
|
|
|
v-if="playing"
|
|
|
|
|
class="ml-4 flex items-center px-3 py-1 rounded-full bg-teal-800 border border-teal-400"
|
|
|
|
|
>
|
|
|
|
|
<div class="playing-dot bg-teal-flashy w-2 h-2 rounded-full"></div>
|
|
|
|
|
<span class="ml-2 text-teal-flashy font-semibold text-sm">In Game</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-09-14 21:19:10 +00:00
|
|
|
<div class="flex">
|
2019-10-22 20:59:22 +00:00
|
|
|
<div :class="{'playing': playing}" class="relative w-24 h-24">
|
2019-09-14 21:19:10 +00:00
|
|
|
<div
|
2019-10-22 20:59:22 +00:00
|
|
|
:class="{'border-2': !playing}"
|
|
|
|
|
class="relative z-10 w-24 h-24 rounded-full bg-blue-1000 border-teal-400"
|
2019-09-14 21:19:10 +00:00
|
|
|
:style="{background: getSummonerIcon}"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="absolute left-0 bottom-0 w-8 h-8 flex items-center justify-center bg-blue-900 rounded-full text-xs text-teal-500 font-extrabold border-2 border-teal-400"
|
2019-10-05 22:01:58 +00:00
|
|
|
>{{ summonerInfos.account.summonerLevel }}</div>
|
2019-09-14 21:19:10 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-10-08 19:54:32 +00:00
|
|
|
|
|
|
|
|
<SummonerRanked
|
|
|
|
|
v-if="Object.entries(summonerInfos.ranked).length !== 0"
|
|
|
|
|
:ranked="summonerInfos.ranked"
|
|
|
|
|
/>
|
2019-09-14 21:19:10 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-09-14 14:10:49 +00:00
|
|
|
|
2019-09-14 21:19:10 +00:00
|
|
|
<div>
|
2019-10-05 22:01:58 +00:00
|
|
|
<RecentActivity :matches="summonerInfos.matchList" />
|
2019-09-14 21:19:10 +00:00
|
|
|
</div>
|
2019-09-14 14:10:49 +00:00
|
|
|
</div>
|
2019-08-19 22:08:13 +00:00
|
|
|
|
2019-10-25 21:09:33 +00:00
|
|
|
<div class="mt-12 text-center flex">
|
|
|
|
|
<div class="mt-4 w-3/12">
|
|
|
|
|
<SummonerMates />
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="w-9/12 text-gray-900">
|
2019-09-14 21:19:10 +00:00
|
|
|
<Match
|
|
|
|
|
v-for="(match, index) in summonerInfos.matches"
|
|
|
|
|
:key="index"
|
|
|
|
|
:data="summonerInfos.matches[index]"
|
|
|
|
|
/>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2019-10-05 22:01:58 +00:00
|
|
|
|
2019-10-06 13:08:24 +00:00
|
|
|
<LoadingButton
|
2019-10-05 22:01:58 +00:00
|
|
|
v-if="moreMatchesToFetch"
|
2019-10-06 13:08:24 +00:00
|
|
|
@clicked="moreMatches"
|
|
|
|
|
:loading="matchesLoading"
|
|
|
|
|
btn-class="mt-4 block mx-auto bg-blue-800 px-4 py-2 rounded-md font-semibold hover:bg-blue-1000 shadow-lg"
|
|
|
|
|
>More matches</LoadingButton>
|
2019-09-14 21:19:10 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2019-03-30 22:55:48 +00:00
|
|
|
|
2019-09-14 21:19:10 +00:00
|
|
|
<template v-else-if="summonerLoading">
|
2019-10-11 19:43:02 +00:00
|
|
|
<SummonerLoader />
|
2019-09-14 21:19:10 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-else-if="summonerNotFound">
|
2019-10-11 19:43:02 +00:00
|
|
|
<div class="mt-16 flex justify-center">
|
2019-10-07 07:54:29 +00:00
|
|
|
<div class="bg-gradient px-4 py-3 rounded-lg text-center text-lg text-blue-100 font-bold">
|
|
|
|
|
<div>Player can't be found.</div>
|
|
|
|
|
<div>😕</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-09-14 21:19:10 +00:00
|
|
|
</template>
|
|
|
|
|
</div>
|
2019-10-22 20:59:22 +00:00
|
|
|
|
2019-10-13 16:12:17 +00:00
|
|
|
<MainFooter />
|
2019-03-30 22:55:48 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-09-11 20:02:05 +00:00
|
|
|
import { mapState, mapActions, mapGetters } from 'vuex'
|
2019-09-14 21:19:10 +00:00
|
|
|
import LazyBackground from '@/components/LazyBackgroundImage.vue'
|
2019-10-06 13:08:24 +00:00
|
|
|
import LoadingButton from '@/components/LoadingButton.vue'
|
2019-10-13 16:12:17 +00:00
|
|
|
import MainFooter from '@/components/MainFooter.vue'
|
2019-11-03 17:49:58 +00:00
|
|
|
import Match from '@/components/Match/Match.vue'
|
2019-10-25 21:09:33 +00:00
|
|
|
import RecentActivity from '@/components/Summoner/RecentActivity.vue'
|
2019-10-13 16:12:17 +00:00
|
|
|
import SearchForm from '@/components/SearchForm.vue'
|
2019-10-25 21:09:33 +00:00
|
|
|
import SummonerLoader from '@/components/Summoner/SummonerLoader.vue'
|
|
|
|
|
import SummonerMates from '@/components/Summoner/SummonerMates.vue'
|
|
|
|
|
import SummonerRanked from '@/components/Summoner/SummonerRanked.vue'
|
2019-03-30 22:55:48 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2019-09-14 21:19:10 +00:00
|
|
|
LazyBackground,
|
2019-10-06 13:08:24 +00:00
|
|
|
LoadingButton,
|
2019-10-13 16:12:17 +00:00
|
|
|
MainFooter,
|
2019-04-08 20:06:22 +00:00
|
|
|
Match,
|
2019-08-19 22:08:13 +00:00
|
|
|
RecentActivity,
|
2019-10-08 19:54:32 +00:00
|
|
|
SearchForm,
|
2019-10-11 19:43:02 +00:00
|
|
|
SummonerLoader,
|
2019-10-25 21:09:33 +00:00
|
|
|
SummonerMates,
|
2019-10-11 19:43:02 +00:00
|
|
|
SummonerRanked,
|
2019-03-30 22:55:48 +00:00
|
|
|
},
|
2019-08-23 14:48:16 +00:00
|
|
|
|
2019-04-07 17:44:01 +00:00
|
|
|
computed: {
|
2019-09-14 21:19:10 +00:00
|
|
|
getSummonerIcon() {
|
2019-10-21 13:30:48 +00:00
|
|
|
return `url(https://ddragon.leagueoflegends.com/cdn/${this.version}/img/profileicon/${this.summonerInfos.account.profileIconId}.png) center/cover`
|
2019-09-14 21:19:10 +00:00
|
|
|
},
|
2019-08-23 14:48:16 +00:00
|
|
|
summoner() {
|
2019-04-07 17:44:01 +00:00
|
|
|
return this.$route.params.name
|
2019-04-08 20:06:22 +00:00
|
|
|
},
|
2019-08-23 14:48:16 +00:00
|
|
|
region() {
|
2019-04-08 20:06:22 +00:00
|
|
|
return this.$route.params.region
|
2019-09-08 20:08:49 +00:00
|
|
|
},
|
|
|
|
|
...mapState({
|
2019-09-14 14:10:49 +00:00
|
|
|
summonerInfos: state => state.summoner.infos
|
2019-09-11 20:02:05 +00:00
|
|
|
}),
|
2019-10-21 13:30:48 +00:00
|
|
|
...mapGetters('ddragon', ['version']),
|
2019-10-22 20:59:22 +00:00
|
|
|
...mapGetters('summoner', ['matchesLoading', 'moreMatchesToFetch', 'playing', 'summonerFound', 'summonerNotFound', 'summonerLoading'])
|
2019-04-07 17:44:01 +00:00
|
|
|
},
|
2019-08-23 14:48:16 +00:00
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
|
$route() {
|
|
|
|
|
console.log('route changed')
|
2019-11-03 17:49:58 +00:00
|
|
|
this.updateCurrentRegion(this.region)
|
2019-09-08 20:08:49 +00:00
|
|
|
this.apiCall()
|
2019-08-23 14:48:16 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2019-09-08 20:08:49 +00:00
|
|
|
mounted() {
|
2019-11-03 17:49:58 +00:00
|
|
|
this.updateCurrentRegion(this.region)
|
2019-09-08 20:08:49 +00:00
|
|
|
this.apiCall()
|
2019-08-23 14:48:16 +00:00
|
|
|
},
|
|
|
|
|
|
2019-03-30 22:55:48 +00:00
|
|
|
methods: {
|
2019-09-29 16:06:54 +00:00
|
|
|
apiCall() {
|
2019-09-09 18:42:10 +00:00
|
|
|
this.summonerRequest({ summoner: this.summoner, region: this.region })
|
2019-04-04 20:29:37 +00:00
|
|
|
},
|
2019-08-23 14:48:16 +00:00
|
|
|
redirect(summoner, region) {
|
2019-04-08 20:06:22 +00:00
|
|
|
this.$router.push(`/summoner/${region}/${summoner}`)
|
2019-03-30 22:55:48 +00:00
|
|
|
},
|
2019-11-03 17:49:58 +00:00
|
|
|
...mapActions(['updateCurrentRegion']),
|
2019-10-05 22:01:58 +00:00
|
|
|
...mapActions('summoner', ['summonerRequest', 'moreMatches']),
|
2019-03-30 22:55:48 +00:00
|
|
|
}
|
2019-08-23 14:48:16 +00:00
|
|
|
}
|
2019-03-30 22:55:48 +00:00
|
|
|
</script>
|
2019-10-22 20:59:22 +00:00
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.playing::before {
|
|
|
|
|
z-index: 0;
|
|
|
|
|
background: rgba(137, 160, 181, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.playing::before,
|
|
|
|
|
.playing::after {
|
|
|
|
|
content: "";
|
|
|
|
|
position: absolute;
|
|
|
|
|
height: 100px;
|
|
|
|
|
width: 100px;
|
|
|
|
|
top: -2px;
|
|
|
|
|
left: -2px;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.playing::after {
|
|
|
|
|
z-index: 0;
|
|
|
|
|
background: linear-gradient(
|
|
|
|
|
to top,
|
|
|
|
|
rgba(0, 0, 0, 0) 30%,
|
|
|
|
|
rgb(36, 232, 204) 100%
|
|
|
|
|
);
|
|
|
|
|
animation: 0.75s linear 0s infinite normal none running rotate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes rotate {
|
|
|
|
|
100% {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.playing-dot {
|
|
|
|
|
box-shadow: 0 0 0 0 rgba(0, 0, 0, 1);
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
animation: 2.5s ease-in-out 0s infinite normal none running pulse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes pulse {
|
|
|
|
|
0% {
|
|
|
|
|
transform: scale(0.95);
|
|
|
|
|
box-shadow: 0 0 0 0 rgba(36, 232, 204, 0.7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
70% {
|
|
|
|
|
transform: scale(1);
|
|
|
|
|
box-shadow: 0 0 0 8px rgba(0, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
transform: scale(0.95);
|
|
|
|
|
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|