| {{ champion.index + 1 }} |
@@ -103,6 +103,10 @@ export default {
champions: {
type: Array,
required: true
+ },
+ search: {
+ type: String,
+ default: ''
}
},
@@ -163,6 +167,7 @@ export default {
}
],
championsFull: [],
+ championsToDisplay: [],
sortProps: 'index',
order: -1
}
@@ -174,6 +179,14 @@ export default {
}
},
+ watch: {
+ search() {
+ this.championsToDisplay = this.championsFull.filter(c => {
+ return c.champion.name.toLowerCase().includes(this.search.toLowerCase())
+ })
+ }
+ },
+
mounted() {
this.championsFull = this.champions.map((champ, index) => {
return {
@@ -182,15 +195,18 @@ export default {
playrate: champ.count * 100 / this.totalGames,
kda: (champ.kills + champ.assists) / champ.deaths,
index,
- lastPlayed: timeDifference(champ.date)
+ lastPlayed: timeDifference(champ.date),
+ show: true
}
})
+
+ this.championsToDisplay = this.championsFull
},
methods: {
bgColor(champion, rgb, stats) {
const value = parseFloat(champion[stats])
- const biggestValue = Math.max(...this.championsFull.map(c => parseFloat(c[stats])), 0)
+ const biggestValue = Math.max(...this.championsToDisplay.map(c => parseFloat(c[stats])), 0)
const opacity = (value / biggestValue).toFixed(2)
return {
@@ -205,7 +221,7 @@ export default {
this.order = -1
}
- this.championsFull.sort((a, b) => {
+ this.championsToDisplay.sort((a, b) => {
const aProp = props.split('.').reduce((p, c) => p && p[c] || null, a)
const bProp = props.split('.').reduce((p, c) => p && p[c] || null, b)
let order = aProp > bProp ? this.order : this.order * -1
diff --git a/client/src/views/SummonerChampions.vue b/client/src/views/SummonerChampions.vue
index 2ceccd3..f0dadb2 100644
--- a/client/src/views/SummonerChampions.vue
+++ b/client/src/views/SummonerChampions.vue
@@ -1,10 +1,12 @@
@@ -12,13 +14,21 @@
|