diff --git a/client/src/components/PopupNotification.vue b/client/src/components/PopupNotification.vue
index 0ebe88b..a460ae7 100644
--- a/client/src/components/PopupNotification.vue
+++ b/client/src/components/PopupNotification.vue
@@ -66,4 +66,4 @@ export default {
...mapActions('notification', ['remove'])
}
}
-
\ No newline at end of file
+
diff --git a/client/src/components/SummonerRanked.vue b/client/src/components/SummonerRanked.vue
new file mode 100644
index 0000000..3215b0f
--- /dev/null
+++ b/client/src/components/SummonerRanked.vue
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
diff --git a/client/src/helpers/summoner.js b/client/src/helpers/summoner.js
index 5819245..808bf2b 100644
--- a/client/src/helpers/summoner.js
+++ b/client/src/helpers/summoner.js
@@ -34,20 +34,16 @@ export function createSummonerData(RiotData) {
console.log(RiotData)
// Ranked Stats
- const soloQStats = RiotData.soloQ
- const soloQ = soloQStats ? {} : null
- if (soloQ) {
- soloQ.rank = `${soloQStats.tier} ${soloQStats.rank}`
- soloQ.rankImgLink = getRankImg(soloQStats)
- soloQ.wins = soloQStats.wins
- soloQ.losses = soloQStats.losses
- soloQ.winrate = +(soloQ.wins * 100 / (soloQ.wins + soloQ.losses)).toFixed(1) + '%'
- soloQ.lp = soloQStats.leaguePoints
- }
+ const uniqueLeagues = ['CHALLENGER', 'GRANDMASTER', 'MASTER']
+ RiotData.ranked.soloQ = getLeagueData(uniqueLeagues, RiotData.ranked.soloQ)
+ RiotData.ranked.soloQ ? RiotData.ranked.soloQ.name = 'Solo/Duo' : delete RiotData.ranked.soloQ
+
+ RiotData.ranked.flex5v5 = getLeagueData(uniqueLeagues, RiotData.ranked.flex5v5)
+ RiotData.ranked.flex5v5 ? RiotData.ranked.flex5v5.name = 'Flex 5vs5' : delete RiotData.ranked.flex5v5
return {
account: RiotData.account,
- soloQ,
+ ranked: RiotData.ranked,
matchList: RiotData.allMatches,
matches: createMatchData(RiotData.matchesDetails)
}
@@ -60,6 +56,15 @@ function getItemLink(id) {
return `url('https://ddragon.leagueoflegends.com/cdn/${process.env.VUE_APP_PATCH}/img/item/${id}.png')`
}
+function getLeagueData(uniqueLeagues, leagueData) {
+ if (!leagueData) return null
+
+ leagueData.rank = uniqueLeagues.includes(leagueData.tier) ? leagueData.tier : `${leagueData.tier} ${leagueData.rank}`
+ leagueData.rankImgLink = getRankImg(leagueData)
+ leagueData.winrate = +(leagueData.wins * 100 / (leagueData.wins + leagueData.losses)).toFixed(1) + '%'
+ return leagueData
+}
+
function getSummonerLink(id) {
const spellName = Object.entries(summonersJSON.data).find(([, spell]) => Number(spell.key) === id)[0]
return `https://ddragon.leagueoflegends.com/cdn/${process.env.VUE_APP_PATCH}/img/spell/${spellName}.png`
diff --git a/client/src/store/modules/summoner.js b/client/src/store/modules/summoner.js
index f440873..fa28447 100644
--- a/client/src/store/modules/summoner.js
+++ b/client/src/store/modules/summoner.js
@@ -9,7 +9,7 @@ export const state = {
matchIndex: 0,
matchList: [],
matches: [],
- soloQ: {}
+ ranked: {}
},
matchesLoading: false,
status: '',
@@ -33,7 +33,7 @@ export const mutations = {
state.infos.account = infos.account
state.infos.matchList = infos.matchList
state.infos.matches = infos.matches
- state.infos.soloQ = infos.soloQ
+ state.infos.ranked = infos.ranked
state.infos.matchIndex = infos.matches.length
state.status = 'found'
},
diff --git a/client/src/views/Summoner.vue b/client/src/views/Summoner.vue
index fc27167..9a78329 100644
--- a/client/src/views/Summoner.vue
+++ b/client/src/views/Summoner.vue
@@ -37,38 +37,11 @@
>{{ summonerInfos.account.summonerLevel }}
-
+
+
@@ -93,7 +66,6 @@
: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
-
@@ -117,6 +89,7 @@ import { mapState, mapActions, mapGetters } from 'vuex'
import LazyBackground from '@/components/LazyBackgroundImage.vue'
import LoadingButton from '@/components/LoadingButton.vue'
import RecentActivity from '@/components/RecentActivity.vue'
+import SummonerRanked from '@/components/SummonerRanked.vue'
import Match from '@/components/Match.vue'
import SearchForm from '@/components/SearchForm.vue'
@@ -126,7 +99,8 @@ export default {
LoadingButton,
Match,
RecentActivity,
- SearchForm
+ SearchForm,
+ SummonerRanked
},
computed: {
diff --git a/server/app/Controllers/Http/SummonerController.js b/server/app/Controllers/Http/SummonerController.js
index 9a93307..cdb5324 100644
--- a/server/app/Controllers/Http/SummonerController.js
+++ b/server/app/Controllers/Http/SummonerController.js
@@ -29,8 +29,10 @@ class SummonerController {
// RANKED STATS
const ranked = await Jax.League.summonerID(account.id)
- const soloQ = ranked.filter(e => e.queueType === 'RANKED_SOLO_5x5')
- finalJSON.soloQ = soloQ.length ? soloQ[0] : null;
+ finalJSON.ranked = {
+ soloQ: ranked.find(e => e.queueType === 'RANKED_SOLO_5x5') || null,
+ flex5v5: ranked.find(e => e.queueType === 'RANKED_FLEX_SR') || null
+ }
// MATCH LIST
const matchList = await MatchHelper.getFullMatchList(account)