feature: sum search results added, Enter closes the preview search field, language file EN, DE adjusted

This commit is contained in:
ogerly 2020-04-15 11:18:15 +02:00
parent e03d209c45
commit 9fe882b39b
4 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="search-results"> <div class="search-results">
<div class="search-results">{{$t('search.results', { searchCount:searchCount, search:search })}}</div>
<tab-navigation :tabs="tabOptions" :activeTab="activeTab" @switchTab="switchTab" /> <tab-navigation :tabs="tabOptions" :activeTab="activeTab" @switchTab="switchTab" />
<section <section
:class="['results', activeTab === 'User' && '--user', !activeResourceCount > 0 && '--empty']" :class="['results', activeTab === 'User' && '--user', !activeResourceCount > 0 && '--empty']"
@ -100,6 +101,7 @@ export default {
postsOffset: 0, postsOffset: 0,
usersOffset: 0, usersOffset: 0,
hashtagsOffset: 0, hashtagsOffset: 0,
searchCount: 0,
} }
}, },
computed: { computed: {
@ -202,6 +204,7 @@ export default {
this.posts = searchPosts.posts this.posts = searchPosts.posts
this.postCount = searchPosts.postCount this.postCount = searchPosts.postCount
if (this.postCount > 0) this.activeTab = 'Post' if (this.postCount > 0) this.activeTab = 'Post'
this.searchCount = ( this.postCount + this.userCount + this.hashtagCount )
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}, },

View File

@ -20,6 +20,7 @@
@keyup.esc.native="clear" @keyup.esc.native="clear"
@blur.capture.native="onBlur" @blur.capture.native="onBlur"
@input.exact="onSelect" @input.exact="onSelect"
> >
<template #option="{ option }"> <template #option="{ option }">
<search-heading v-if="isFirstOfType(option)" :resource-type="option.__typename" /> <search-heading v-if="isFirstOfType(option)" :resource-type="option.__typename" />
@ -112,6 +113,7 @@ export default {
path: '/search/search-results', path: '/search/search-results',
query: { search: this.unprocessedSearchInput }, query: { search: this.unprocessedSearchInput },
}) })
this.$emit('clearSearch')
}, },
onDelete(event) { onDelete(event) {
clearTimeout(this.searchProcess) clearTimeout(this.searchProcess)

View File

@ -595,6 +595,7 @@
"User": "Benutzer" "User": "Benutzer"
}, },
"hint": "Wonach suchst Du?", "hint": "Wonach suchst Du?",
"results": " \"{searchCount}\" Ergebnisse für \"{search}\" gefunden ",
"no-results": "Keine Ergebnisse für \"{search}\" gefunden. Versuch' es mit einem anderen Begriff!", "no-results": "Keine Ergebnisse für \"{search}\" gefunden. Versuch' es mit einem anderen Begriff!",
"placeholder": "Suchen" "placeholder": "Suchen"
}, },

View File

@ -595,6 +595,7 @@
"User": "Users" "User": "Users"
}, },
"hint": "What are you searching for?", "hint": "What are you searching for?",
"results": " \"{searchCount}\" Results found for \"{search}\" ",
"no-results": "No results found for \"{search}\". Try a different search term!", "no-results": "No results found for \"{search}\". Try a different search term!",
"placeholder": "Search" "placeholder": "Search"
}, },