|
6 | 6 | {{recommendations.length}} {{title}}</h1> |
7 | 7 | <div class="flex w-full items-stretch sm:items-center justify-center md:justify-start mb-12 relative"> |
8 | 8 | <Sort |
9 | | - v-bind:position="'left'" |
| 9 | + v-if="recommendationsBackup.length > 1" |
| 10 | + v-bind:position="getPosition('left')" |
10 | 11 | v-bind:startingOption="'Closest'" |
11 | 12 | v-bind:options="['Closest', 'Furthest', 'Youngest', |
12 | 13 | 'Oldest', 'Most popular', 'Least popular', 'Most common interests', 'Least common interests']" |
13 | 14 | v-on:save-sort="saveSort"></Sort> |
14 | 15 | <FilterSliderDropdown |
| 16 | + v-if="recommendationsBackup.length > 1 && recommendationsAnalysis.age.min !== recommendationsAnalysis.age.max" |
15 | 17 | v-bind:min="recommendationsAnalysis.age.min" |
16 | 18 | v-bind:max="recommendationsAnalysis.age.max" |
17 | 19 | v-bind:name="'age'" |
18 | 20 | v-on:save-filter="saveFilter"></FilterSliderDropdown> |
19 | 21 | <FilterSliderDropdown |
| 22 | + v-if="recommendationsBackup.length > 1 && recommendationsAnalysis.distance.min !== recommendationsAnalysis.distance.max" |
20 | 23 | v-bind:min="recommendationsAnalysis.distance.min" |
21 | 24 | v-bind:max="recommendationsAnalysis.distance.max" |
22 | 25 | v-bind:unit="'km'" |
23 | 26 | v-bind:name="'distance'" |
24 | 27 | v-on:save-filter="saveFilter"></FilterSliderDropdown> |
25 | 28 | <FilterSliderDropdown |
| 29 | + v-if="recommendationsBackup.length > 1 && recommendationsAnalysis.popularity.min !== recommendationsAnalysis.popularity.max" |
26 | 30 | v-bind:min="recommendationsAnalysis.popularity.min" |
27 | 31 | v-bind:max="recommendationsAnalysis.popularity.max" |
28 | 32 | v-bind:unit="'pts'" |
29 | 33 | v-bind:name="'popularity'" |
30 | 34 | v-on:save-filter="saveFilter"></FilterSliderDropdown> |
31 | 35 | <MultipleFiltersDropdown |
32 | | - v-bind:position="'right'" |
| 36 | + v-if="recommendationsBackup.length > 1" |
| 37 | + v-bind:position="getPosition('right')" |
33 | 38 | v-bind:options="recommendationsAnalysis.interests" |
34 | 39 | v-bind:name="'interests'" |
35 | 40 | v-on:save-filter-multiple="saveFilterMultiple"></MultipleFiltersDropdown> |
@@ -78,6 +83,15 @@ export default { |
78 | 83 | }, |
79 | 84 | }), |
80 | 85 | methods: { |
| 86 | + getPosition(initialPosition) { |
| 87 | + if (this.recommendationsBackup.length > 1 |
| 88 | + && this.recommendationsAnalysis.age.min !== this.recommendationsAnalysis.age.max |
| 89 | + && this.recommendationsAnalysis.distance.min !== this.recommendationsAnalysis.distance.max |
| 90 | + && this.recommendationsAnalysis.popularity.min !== this.recommendationsAnalysis.popularity.max) { |
| 91 | + return initialPosition; |
| 92 | + } |
| 93 | + return null; |
| 94 | + }, |
81 | 95 | saveSort(...args) { |
82 | 96 | const [by] = args; |
83 | 97 | this.sorting = by; |
|
0 commit comments