Skip to content

Commit 155cf3b

Browse files
committed
Merge remote-tracking branch 'origin/294-recommendations' into 294-recommendations
2 parents e345ff9 + 918a97c commit 155cf3b

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

frontend/src/assets/search.png

399 KB
Loading

frontend/src/components/shared/MultipleFilters.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<!-- eslint-disable max-len -->
33
<div class='mx-auto max-w-md mb-4'>
4-
<h1 class="text-xl lg text-purple-matcha capitalize text-left mb-4">{{ name }}</h1>
4+
<h1 class="text-xl lg text-purple-matcha capitalize text-left">{{ name }}</h1>
5+
<h1 class="text-md text-left opacity-50 mb-4">{{ info }}</h1>
56
<div class="h-48 w-auto overflow-scroll rounded-md border border-gray-300 bg-white">
67
<h1 v-for="(option, index) in options" :key="option + index + option"
78
v-bind:class="{'sort-dropdown-option': true, 'text-lg': true, 'border-b': index !== options.length - 1, 'capitalize': true,
@@ -15,7 +16,7 @@
1516

1617
<script>
1718
export default {
18-
props: ['options', 'name', 'position'],
19+
props: ['options', 'name', 'info', 'position'],
1920
data: () => ({
2021
closed: true,
2122
selectedFilters: [],

frontend/src/views/app/Search.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
v-bind:recommendationsReceived="recommendations"
1212
v-bind:recommendationsAnalysis="filters"></Recommendations>
1313
</section>
14-
<section v-if="!recommendationsAnalysisDone && sliderValuesFetched" class="flex flex-col my-8 md:my-12">
14+
<section v-on:click="setError(null)"
15+
v-if="!recommendationsAnalysisDone && sliderValuesFetched"
16+
class="flex flex-col my-8 md:my-12">
17+
<div><img src="../../assets/search.png" class="w-20 mb-4 mx-auto"></div>
1518
<div>
1619
<FilterSlider
1720
v-bind:min="sliders.age.min"
@@ -46,8 +49,10 @@
4649
'astrology', 'board games', 'craft beer', 'coffee', 'writer',
4750
]"
4851
v-bind:name="'interests'"
52+
v-bind:info="'If no selected, all are accounted.'"
4953
v-on:saveFilterMultiple="saveFilterMultiple"></MultipleFilters>
5054
</div>
55+
<div class="auth-sub-container-error mx-auto max-w-md" v-if="error"><h1 class="auth-sub-container-error-message">{{ error }}</h1></div>
5156
<div class="mx-auto w-full max-w-md">
5257
<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">
5358
Search</h1>
@@ -99,6 +104,7 @@ export default {
99104
interests: [],
100105
},
101106
recommendationsAnalysisDone: false,
107+
error: null,
102108
}),
103109
methods: {
104110
saveFilter(...range) {
@@ -137,6 +143,10 @@ export default {
137143
];
138144
}
139145
this.recommendations = searchRequest.data.search_results;
146+
if (this.recommendations.length === 0) {
147+
this.setError('0 profiles found. Please, try expanding your search criteria.');
148+
return;
149+
}
140150
this.recommendations.sort((a, b) => a.distance - b.distance);
141151
for (let i = 0; i < this.recommendations.length; i += 1) {
142152
if (this.recommendations[i].age < 18) {
@@ -150,10 +160,23 @@ export default {
150160
}
151161
}
152162
this.recommendationsAnalysisDone = true;
163+
this.scrollToTop();
153164
},
154165
searchAgain() {
166+
this.filters.age.min = null;
167+
this.filters.age.max = null;
168+
this.filters.popularity.min = null;
169+
this.filters.popularity.max = null;
170+
this.filters.distance.max = null;
171+
this.filters.interests = [];
155172
this.recommendationsAnalysisDone = false;
156173
},
174+
setError(message) {
175+
this.error = message;
176+
},
177+
scrollToTop() {
178+
window.scrollTo(0, 0);
179+
},
157180
},
158181
async mounted() {
159182
const sliderRangesRequest = await this.$http.get('/search/values');

0 commit comments

Comments
 (0)