Skip to content

Commit 9950a67

Browse files
supalarrySeluj78
authored andcommitted
WIP search loading icon
1 parent 22a8166 commit 9950a67

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

frontend/src/views/app/Search.vue

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<template>
22
<!-- eslint-disable max-len -->
3-
<div class="mx-4 sm:mx-16 lg:mx-32">
3+
<div v-bind:class="{
4+
'mx-4': true,
5+
'sm:mx-16': true,
6+
'lg:mx-32': true,
7+
'md:flex': searchedAtLeastOnce}">
8+
<div v-if="!recommendationsAnalysisDone && !sliderValuesFetched" class="mx-auto flex items-center justify-center mt-32">
9+
<img class="h-36" src="../../assets/loading.svg">
10+
</div>
411
<section v-if="recommendationsAnalysisDone" class="mx-auto">
512
<div class="sort-button rounded-md text-lg lg:text-2xl w-24 ml-auto" v-on:click="searchAgain()">
613
<h1 class="noSelect capitalize">←</h1>
@@ -13,7 +20,7 @@
1320
<section v-on:click="setError(null)"
1421
v-if="!recommendationsAnalysisDone && sliderValuesFetched"
1522
class="flex flex-col my-8 md:my-12">
16-
<div><img src="../../assets/search.png" class="w-20 mb-4 mx-auto"></div>
23+
<div class="md:hidden"><img src="../../assets/search.png" class="w-20 mb-4 mx-auto"></div>
1724
<div>
1825
<FilterSlider
1926
v-bind:min="sliders.age.min"
@@ -53,8 +60,11 @@
5360
</div>
5461
<div class="auth-sub-container-error mx-auto max-w-md" v-if="error"><h1 class="auth-sub-container-error-message">{{ error }}</h1></div>
5562
<div class="mx-auto w-full max-w-md">
56-
<h1 v-on:click="search()" class="onboarding-sub-container-content-button-outline w-48 text-lg font-normal max-w-full bg-purple-matcha w-full text-white-matcha mx-auto">
63+
<h1 v-if="!submitted" v-on:click="search()" class="onboarding-sub-container-content-button-outline w-48 text-lg font-normal max-w-full bg-purple-matcha w-full text-white-matcha mx-auto">
5764
Search</h1>
65+
<div v-else class="flex items-center justify-center mt-4">
66+
<img class="h-12" src="../../assets/loading.svg">
67+
</div>
5868
</div>
5969
</section>
6070
</div>
@@ -88,21 +98,23 @@ export default {
8898
sliderValuesFetched: false,
8999
filters: {
90100
age: {
91-
min: null,
92-
max: null,
101+
min: -1,
102+
max: -1,
93103
},
94104
distance: {
95105
min: 0,
96-
max: null,
106+
max: -1,
97107
},
98108
popularity: {
99-
min: null,
100-
max: null,
109+
min: -1,
110+
max: -1,
101111
},
102112
interests: [],
103113
},
104114
recommendationsAnalysisDone: false,
105115
error: null,
116+
searchedAtLeastOnce: false,
117+
submitted: false,
106118
}),
107119
methods: {
108120
saveFilter(...range) {
@@ -131,6 +143,7 @@ export default {
131143
this.sliderValuesFetched = true;
132144
},
133145
async search() {
146+
this.submitted = true;
134147
const searchRequest = await this.$http.post('/search', {
135148
min_age: this.filters.age.min,
136149
max_age: this.filters.age.max,
@@ -154,6 +167,7 @@ export default {
154167
}
155168
this.recommendations = searchRequest.data.search_results;
156169
if (this.recommendations.length === 0) {
170+
this.submitted = false;
157171
this.setError('0 profiles found. Please, try expanding your search criteria.');
158172
return;
159173
}
@@ -169,6 +183,8 @@ export default {
169183
this.recommendations[i].interests.push(interests[j].name);
170184
}
171185
}
186+
this.submitted = false;
187+
this.searchedAtLeastOnce = true;
172188
this.recommendationsAnalysisDone = true;
173189
this.scrollToTop();
174190
},

0 commit comments

Comments
 (0)