Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/components/search/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const options = ref([{ name: 'Suggestions' }, { label: 2497, value: 2497, name:
const model = ref([])
const loading = ref(false)
const activateSearch = ref(true)
const showMapDialog = ref(false)
const isSearchBarDisabled = ref(false)

const Address4 = ipAddress.Address4
const Address6 = ipAddress.Address6
Expand Down Expand Up @@ -316,6 +318,7 @@ const optimizeSearchResults = (res) => {
}

const filter = (value, update, abort) => {
if (isSearchBarDisabled.value) return
activateSearch.value = true
if (value.length < MIN_CHARACTERS) {
abort()
Expand Down Expand Up @@ -445,8 +448,6 @@ const routeToRank = (rank) => {
)
}

const showMapDialog = ref(false)

const showMap = () => {
showMapDialog.value = true
}
Expand All @@ -464,6 +465,10 @@ watch(
activateSearch.value = false
}
)

watch(showMapDialog, (newVal) => {
isSearchBarDisabled.value = newVal
})
</script>

<template>
Expand All @@ -481,11 +486,16 @@ watch(
:input-class="input"
hide-selected
@filter="filter"
:disable="isSearchBarDisabled"
>
<template #append>
<div v-if="!props.noCountry" @click="showMap">
<QBtn :color="label" icon="fas fa-map" flat dense />
<QDialog v-model="showMapDialog">
<QDialog
v-model="showMapDialog"
@show="isSearchBarDisabled = true"
@hide="isSearchBarDisabled = false"
>
<WorldMap @country-selected="handleCountryClicked" />
</QDialog>
</div>
Expand Down Expand Up @@ -604,4 +614,4 @@ watch(
.IHR_search-bar {
color: 'white';
}
</style>
</style>
Loading