-
+
-
-
Recent searches:
-
-
-
-
-
-
- Example :
-
-
+
+
+
+ Enter
+ to select
+
+
+ ↓ ↑
+ to navigate
+
+
+ Escape
+ to close
+
+
+ CTRL K
+ to open
+
+
@@ -44,24 +118,127 @@
+
+
diff --git a/client/src/components/Form/SearchFormDropdownPlayer.vue b/client/src/components/Form/SearchFormDropdownPlayer.vue
index a2d6cf5..13eef56 100644
--- a/client/src/components/Form/SearchFormDropdownPlayer.vue
+++ b/client/src/components/Form/SearchFormDropdownPlayer.vue
@@ -2,24 +2,47 @@
- {{ player.region }}
-
- {{ player.name }}
-
-
+
+
+
+
+
+
{{ player.name }}
+
+
+
+
+
@@ -28,10 +51,6 @@ import { mapActions } from 'vuex'
export default {
props: {
- favorite: {
- type: Boolean,
- default: false,
- },
favoritesList: {
type: Boolean,
default: false,
@@ -40,6 +59,10 @@ export default {
type: Object,
required: true,
},
+ selected: {
+ type: Boolean,
+ default: false
+ }
},
methods: {
@@ -51,9 +74,6 @@ export default {
this.removeRecentSearch(this.player)
},
favoriteClick() {
- if (this.favorite) {
- return
- }
this.updateFavorite(this.player)
},
...mapActions('settings', ['removeRecentSearch', 'updateFavorite'])
diff --git a/client/src/components/Form/SearchFormRegion.vue b/client/src/components/Form/SearchFormRegion.vue
new file mode 100644
index 0000000..d5d4e1b
--- /dev/null
+++ b/client/src/components/Form/SearchFormRegion.vue
@@ -0,0 +1,133 @@
+
+
+
+
+ {{ selectedRegion }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/client/src/components/Global/SVGContainer.vue b/client/src/components/Global/SVGContainer.vue
index 3ee8aab..1c9987a 100644
--- a/client/src/components/Global/SVGContainer.vue
+++ b/client/src/components/Global/SVGContainer.vue
@@ -26,6 +26,7 @@
+
diff --git a/client/src/layouts/Default.vue b/client/src/layouts/Default.vue
index 663e15f..c17360b 100644
--- a/client/src/layouts/Default.vue
+++ b/client/src/layouts/Default.vue
@@ -12,14 +12,14 @@
class="fixed left-0 right-0 z-20 px-4 text-teal-100 transition-colors duration-100 ease-in-out border-b-2"
style="border-color: rgba(144, 205, 244, 0.4);"
>
-
+
-
+
@@ -44,7 +44,7 @@
-
+
diff --git a/client/src/store/modules/settings.js b/client/src/store/modules/settings.js
index d8b7e71..07687e9 100644
--- a/client/src/store/modules/settings.js
+++ b/client/src/store/modules/settings.js
@@ -12,27 +12,32 @@ export const mutations = {
state.favorites.push(summoner)
},
ADD_SEARCH(state, summoner) {
+ const alreadyFav = state.favorites.find(s => s.name === summoner.name && s.region === summoner.region)
+ if (alreadyFav) {
+ return
+ }
+
let searches = state.recentSearches
- const alreadySearch = searches.find(s => s.name === summoner.name)
+ const alreadySearch = searches.find(s => s.name === summoner.name && s.region === summoner.region)
if (alreadySearch) {
alreadySearch.date = Date.now()
searches.sort((a, b) => b.date - a.date)
return
}
- if (searches.length >= 6) {
+ if (searches.length > 10) {
searches.pop()
}
summoner.date = Date.now()
searches.unshift(summoner)
},
- REMOVE_FAVORITE(state, summonerName) {
- state.favorites = state.favorites.filter(s => s.name !== summonerName)
+ REMOVE_FAVORITE(state, summoner) {
+ state.favorites = state.favorites.filter(s => s.name !== summoner.name || s.region !== summoner.region)
},
- REMOVE_SEARCH(state, summonerName) {
- state.recentSearches = state.recentSearches.filter(s => s.name !== summonerName)
+ REMOVE_SEARCH(state, summoner) {
+ state.recentSearches = state.recentSearches.filter(s => s.name !== summoner.name || s.region !== summoner.region)
},
UPDATE_SETTING(state, { name, value }) {
state[name] = value
@@ -45,13 +50,13 @@ export const actions = {
dispatch('updateSettings', { name: 'recentSearches', value: state.recentSearches, isJson: true })
},
removeRecentSearch({ commit, dispatch }, summoner) {
- commit('REMOVE_SEARCH', summoner.name)
+ commit('REMOVE_SEARCH', summoner)
dispatch('updateSettings', { name: 'recentSearches', value: state.recentSearches, isJson: true })
},
updateFavorite({ commit, dispatch, state }, summoner) {
- const alreadyFav = state.favorites.find(s => s.name === summoner.name)
+ const alreadyFav = state.favorites.find(s => s.name === summoner.name && s.region === summoner.region)
if (alreadyFav) {
- commit('REMOVE_FAVORITE', summoner.name)
+ commit('REMOVE_FAVORITE', summoner)
} else {
if (state.favorites.length >= 6) {
// Display error message
@@ -61,6 +66,10 @@ export const actions = {
}, { root: true })
}
commit('ADD_FAVORITE', summoner)
+ const searched = state.recentSearches.find(s => s.name === summoner.name && s.region === summoner.region)
+ if (searched) {
+ dispatch('removeRecentSearch', summoner)
+ }
}
dispatch('updateSettings', { name: 'favorites', value: state.favorites, isJson: true })
diff --git a/client/src/views/Home.vue b/client/src/views/Home.vue
index f02f44b..71e5ff1 100644
--- a/client/src/views/Home.vue
+++ b/client/src/views/Home.vue
@@ -17,7 +17,7 @@

-
+