Skip to content

Commit

Permalink
fixed global search dialog manual select
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Dec 23, 2024
1 parent 0c66374 commit 65034e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vue3/src/components/inputs/GlobalSearchDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!-- search results -->
<v-card-text>
<v-card :variant="cardVariant(index)" v-for="(item, index) in searchResults" hover class="mt-1" @click="selectedResult = index" :key="index">
<v-card-title @click="goToSelectedRecipe()">
<v-card-title @click="goToSelectedRecipe(index)">
<v-avatar v-if="item.image" :image="item.image"></v-avatar>
<v-avatar v-else-if="item.recipe_id !== undefined" color="tandoor">{{ item.name.charAt(0) }}</v-avatar>
<v-icon :icon="item.icon" v-if="item.icon"></v-icon>
Expand Down Expand Up @@ -134,7 +134,7 @@ onMounted(() => {
selectedResult.value = Math.min(searchResults.value.length, selectedResult.value + 1)
}
if (e.key == 'Enter') {
goToSelectedRecipe()
goToSelectedRecipe(selectedResult.value)
}
} else {
if (e.key == 'k' && e.ctrlKey) {
Expand Down Expand Up @@ -165,9 +165,9 @@ function cardVariant(index: number) {
/**
* open selected recipe
*/
function goToSelectedRecipe() {
function goToSelectedRecipe(index: number) {
dialog.value = false
let searchResult = searchResults.value[selectedResult.value]
let searchResult = searchResults.value[index]
console.log('going to', searchResult.recipe_id)
if (searchResult.recipe_id != null) {
router.push({name: 'view_recipe', params: {'id': searchResult.recipe_id}})
Expand Down

0 comments on commit 65034e5

Please sign in to comment.