Skip to content

Commit 49ab54e

Browse files
feat: don't obstruct map when loading division results
1 parent 884f65d commit 49ab54e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/App.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const searchResults = ref({ matches: [], divisions: [], searchTerm: '' })
99
const isResultsExpanded = ref(false)
1010
const searchQuery = ref('')
1111
const isSearching = ref(false)
12+
const isDivisionLoading = ref(false)
1213
1314
function handleSearch(results) {
1415
searchResults.value = results
@@ -25,6 +26,10 @@ function handleMapSearch(results) {
2526
// Clear the search box without triggering a search clear
2627
searchQuery.value = ''
2728
}
29+
30+
function handleDivisionLoadingChange(loading) {
31+
isDivisionLoading.value = loading
32+
}
2833
</script>
2934

3035
<template>
@@ -39,10 +44,11 @@ function handleMapSearch(results) {
3944
:searchResults="searchResults"
4045
:isResultsExpanded="isResultsExpanded"
4146
@update:searchResults="handleMapSearch"
47+
@update:loading="handleDivisionLoadingChange"
4248
/>
4349
<SearchResults
4450
:results="searchResults"
45-
:isLoading="isSearching"
51+
:isLoading="isSearching || isDivisionLoading"
4652
@update:expanded="handleExpandedChange"
4753
/>
4854
</div>

src/components/MapView.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ let userMarker = null
1414
// Loading states
1515
const isLoadingMap = ref(true)
1616
const isLoadingLocation = ref(false)
17-
const isLoadingDivision = ref(false)
1817
1918
// Initialize Supabase client
2019
const supabase = createClient(
@@ -45,7 +44,7 @@ const props = defineProps({
4544
}
4645
})
4746
48-
const emit = defineEmits(['update:searchResults'])
47+
const emit = defineEmits(['update:searchResults', 'update:loading'])
4948
5049
// Create a custom marker element
5150
function createMarkerElement() {
@@ -141,7 +140,7 @@ async function getUserLocation() {
141140
// Function to select and load division data
142141
async function selectDivision(division, location = null) {
143142
console.log('Selecting division:', division);
144-
isLoadingDivision.value = true;
143+
emit('update:loading', true);
145144
146145
try {
147146
const { data, error } = await supabase
@@ -180,7 +179,7 @@ async function selectDivision(division, location = null) {
180179
} catch (err) {
181180
console.error('Search error:', err);
182181
} finally {
183-
isLoadingDivision.value = false;
182+
emit('update:loading', false);
184183
}
185184
}
186185
@@ -339,11 +338,6 @@ onUnmounted(() => {
339338
<div class="loading-spinner"></div>
340339
<div class="loading-text">Getting your location...</div>
341340
</div>
342-
343-
<div v-if="isLoadingDivision" class="loading-overlay">
344-
<div class="loading-spinner"></div>
345-
<div class="loading-text">Loading division data...</div>
346-
</div>
347341
</div>
348342
</template>
349343

0 commit comments

Comments
 (0)