mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
feat: display old summoner names on actual summoner name hover
This commit is contained in:
parent
8db630389a
commit
335fe5c4a6
4 changed files with 49 additions and 6 deletions
|
|
@ -53,10 +53,29 @@
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<h1 class="text-4xl font-extrabold uppercase">
|
<Tooltip>
|
||||||
<span class="text-5xl">{{ basic.account.name[0] }}</span>
|
<template v-slot:trigger>
|
||||||
<span>{{ basic.account.name.substring(1) }}</span>
|
<h1 class="text-4xl font-extrabold uppercase">
|
||||||
</h1>
|
<span class="text-5xl">{{ basic.account.name[0] }}</span>
|
||||||
|
<span>{{ basic.account.name.substring(1) }}</span>
|
||||||
|
</h1>
|
||||||
|
</template>
|
||||||
|
<template v-slot:default>
|
||||||
|
<div
|
||||||
|
v-if="basic.account.names.length > 1"
|
||||||
|
class="px-2 text-sm text-center text-white select-none"
|
||||||
|
>
|
||||||
|
<div>Old summoner names</div>
|
||||||
|
<ul class="pl-2 text-left">
|
||||||
|
<li
|
||||||
|
v-for="name in basic.account.names"
|
||||||
|
:key="name.date"
|
||||||
|
class="text-teal-400"
|
||||||
|
>{{ name.name }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Tooltip>
|
||||||
<div
|
<div
|
||||||
v-if="playing"
|
v-if="playing"
|
||||||
class="flex items-center px-3 py-1 mt-2 ml-4 bg-teal-800 border border-teal-400 rounded-full"
|
class="flex items-center px-3 py-1 mt-2 ml-4 bg-teal-800 border border-teal-400 rounded-full"
|
||||||
|
|
@ -164,6 +183,7 @@ import RecentActivity from '@/components/Summoner/RecentActivity.vue'
|
||||||
import SearchForm from '@/components/Form/SearchForm.vue'
|
import SearchForm from '@/components/Form/SearchForm.vue'
|
||||||
import HeaderLoader from '@/components/Summoner/HeaderLoader.vue'
|
import HeaderLoader from '@/components/Summoner/HeaderLoader.vue'
|
||||||
import SummonerRanked from '@/components/Summoner/SummonerRanked.vue'
|
import SummonerRanked from '@/components/Summoner/SummonerRanked.vue'
|
||||||
|
import Tooltip from '@/components/Common/Tooltip.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -174,6 +194,7 @@ export default {
|
||||||
SearchForm,
|
SearchForm,
|
||||||
HeaderLoader,
|
HeaderLoader,
|
||||||
SummonerRanked,
|
SummonerRanked,
|
||||||
|
Tooltip
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,12 @@ class SummonerController {
|
||||||
{ puuid: account.puuid }
|
{ puuid: account.puuid }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Summoner names
|
||||||
|
finalJSON.account.names = SummonerService.getAllSummonerNames(account, summonerDB)
|
||||||
|
|
||||||
// MATCH LIST
|
// MATCH LIST
|
||||||
await MatchService.updateMatchList(account, summonerDB)
|
await MatchService.updateMatchList(account, summonerDB)
|
||||||
const matchList = summonerDB.matchList
|
finalJSON.matchList = summonerDB.matchList
|
||||||
finalJSON.matchList = matchList
|
|
||||||
|
|
||||||
// All seasons the summoner has played
|
// All seasons the summoner has played
|
||||||
finalJSON.seasons = await this._getSeasons(account.puuid)
|
finalJSON.seasons = await this._getSeasons(account.puuid)
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,7 @@ class MatchRepository {
|
||||||
]
|
]
|
||||||
return this._aggregate(puuid, matchParams, [], '$role', {}, finalSteps)
|
return this._aggregate(puuid, matchParams, [], '$role', {}, finalSteps)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Summoner's played seasons
|
* Get Summoner's played seasons
|
||||||
* @param puuid of the summoner
|
* @param puuid of the summoner
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,25 @@ class SummonerService {
|
||||||
return account
|
return account
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the full list of old and actual summoner names
|
||||||
|
* @param account of the summoner
|
||||||
|
* @param summonerDB summoner in the database
|
||||||
|
*/
|
||||||
|
getAllSummonerNames(account, summonerDB) {
|
||||||
|
const names = summonerDB.names ? summonerDB.names : []
|
||||||
|
|
||||||
|
if (!names.find(n => n.name === account.name)) {
|
||||||
|
names.push({
|
||||||
|
name: account.name,
|
||||||
|
date: new Date()
|
||||||
|
})
|
||||||
|
summonerDB.names = names
|
||||||
|
}
|
||||||
|
|
||||||
|
return names
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ranked data for a specific Summoner
|
* Get ranked data for a specific Summoner
|
||||||
* @param account
|
* @param account
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue