Skip to content

Commit 612541e

Browse files
committed
wip history
1 parent 1aa70d6 commit 612541e

File tree

4 files changed

+55
-59
lines changed

4 files changed

+55
-59
lines changed

frontend/src/components/app/recommendations/HistoryRecommendations.vue

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
<template>
22
<!-- eslint-disable max-len -->
33
<section class="mb-4 sm:mb-16 lg:mb-32">
4-
<div class="flex items-center justify-center md:justify-start w-full mb-4">
5-
<h1
6-
class="text-3xl sm:text-5xl my-4 inline-block text-center leading-none onboarding-sub-container-content-heading">
7-
{{recommendations.length}}</h1>
8-
<DropdownDisplayChoiceHistory
9-
v-on:save-single-choice="saveSingleChoice"
10-
class="inline-block ml-4"
11-
v-bind:name="'history'"
12-
v-bind:starting-option="'People I viewed'"
13-
v-bind:options="['People I viewed', 'People I liked', 'Who viewed me', 'Who liked me', 'Whom I blocked']"></DropdownDisplayChoiceHistory>
14-
</div>
15-
<div class="flex w-full items-stretch sm:items-center justify-center md:justify-start mb-12 relative">
4+
<div v-if="recommendations.length && ready" class="flex w-full items-stretch sm:items-center justify-center md:justify-start mb-12 relative">
165
<Sort
176
v-bind:position="'left'"
187
v-bind:startingOption="'Closest'"
@@ -42,7 +31,7 @@
4231
v-bind:name="'interests'"
4332
v-on:save-filter-multiple="saveFilterMultiple"></MultipleFiltersDropdown>
4433
</div>
45-
<div v-if="ready" ref="recommendationCards" class="grid grid-cols-1 md:grid-cols-2 gap-2">
34+
<div v-if="recommendations.length && ready" ref="recommendationCards" class="grid grid-cols-1 md:grid-cols-2 gap-2">
4635
<RecommendationCard
4736
v-for="(recommendation, index) in recommendations" :key="index"
4837
v-bind:recommendation="recommendation"></RecommendationCard>
@@ -56,7 +45,6 @@ import Sort from '@/components/shared/Sort.vue';
5645
import FilterSliderDropdown from '@/components/shared/FilterSliderDropdown.vue';
5746
import RecommendationCard from '@/components/app/recommendations/RecommendationCard.vue';
5847
import MultipleFiltersDropdown from '@/components/shared/MultipleFiltersDropdown.vue';
59-
import DropdownDisplayChoiceHistory from '@/components/shared/DropdownDisplayChoiceHistory.vue';
6048
6149
export default {
6250
props: ['title', 'recommendationsReceived', 'recommendationsAnalysis', 'ready'],
@@ -65,7 +53,6 @@ export default {
6553
RecommendationCard,
6654
FilterSliderDropdown,
6755
MultipleFiltersDropdown,
68-
DropdownDisplayChoiceHistory,
6956
},
7057
data: () => ({
7158
recommendations: [],
@@ -177,6 +164,16 @@ export default {
177164
this.$emit('update-history', value);
178165
}
179166
},
167+
setupRecommendations() {
168+
this.recommendations = this.filterOutBlockedUsers(this.recommendationsReceived);
169+
this.recommendationsBackup = this.recommendations;
170+
this.filters.age.min = this.recommendationsAnalysis.age.min;
171+
this.filters.age.max = this.recommendationsAnalysis.age.max;
172+
this.filters.distance.min = this.recommendationsAnalysis.distance.min;
173+
this.filters.distance.max = this.recommendationsAnalysis.distance.max;
174+
this.filters.popularity.min = this.recommendationsAnalysis.popularity.min;
175+
this.filters.popularity.max = this.recommendationsAnalysis.popularity.max;
176+
},
180177
},
181178
watch: {
182179
sorting: {
@@ -192,17 +189,15 @@ export default {
192189
this.recommendations = base;
193190
},
194191
deep: true,
195-
}
192+
},
193+
recommendations: {
194+
handler() {
195+
this.setupRecommendations();
196+
},
197+
},
196198
},
197199
beforeMount() {
198-
this.recommendations = this.filterOutBlockedUsers(this.recommendationsReceived);
199-
this.recommendationsBackup = this.recommendations;
200-
this.filters.age.min = this.recommendationsAnalysis.age.min;
201-
this.filters.age.max = this.recommendationsAnalysis.age.max;
202-
this.filters.distance.min = this.recommendationsAnalysis.distance.min;
203-
this.filters.distance.max = this.recommendationsAnalysis.distance.max;
204-
this.filters.popularity.min = this.recommendationsAnalysis.popularity.min;
205-
this.filters.popularity.max = this.recommendationsAnalysis.popularity.max;
206-
}
200+
this.setupRecommendations();
201+
},
207202
};
208203
</script>

frontend/src/components/shared/DropdownDisplayChoiceHistory.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default {
2525
select(option) {
2626
this.close();
2727
this.currentOption = option;
28+
console.log(option);
2829
this.$emit('save-single-choice', this.name, option);
2930
},
3031
toggle() {

frontend/src/main.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import Vue from 'vue';
22
import { ValidationProvider, ValidationObserver, extend } from 'vee-validate/dist/vee-validate.full.esm';
3-
import * as Sentry from '@sentry/browser';
4-
import { Vue as VueIntegration } from '@sentry/integrations';
5-
import { Integrations } from '@sentry/tracing';
63
import http from './plugins/http';
74
import errorMessenger from './plugins/errorMessenger';
85
import App from './App.vue';
@@ -11,18 +8,6 @@ import store from './store';
118
import validPassword from './validators/validPassword';
129
import './assets/css/tailwind.css';
1310

14-
Sentry.init({
15-
dsn: 'https://fc31e918801742e2b1e691067496e257@o450203.ingest.sentry.io/5434440',
16-
integrations: [
17-
new VueIntegration({
18-
Vue,
19-
tracing: true,
20-
}),
21-
new Integrations.BrowserTracing(),
22-
],
23-
tracesSampleRate: 1,
24-
});
25-
2611
Vue.component('ValidationProvider', ValidationProvider);
2712
Vue.component('ValidationObserver', ValidationObserver);
2813
extend('validPassword', validPassword);

frontend/src/views/app/History.vue

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33
<div class="mx-4 sm:mx-16 lg:mx-32">
44
<NavBar v-bind:currentRoute="'History'"></NavBar>
55
<section class="mx-auto">
6+
<div class="flex items-center justify-center md:justify-start w-full mb-4">
7+
<h1
8+
class="text-3xl sm:text-5xl my-4 inline-block text-center leading-none onboarding-sub-container-content-heading">
9+
{{recommendations.length}}</h1>
10+
<DropdownDisplayChoiceHistory
11+
v-on:save-single-choice="updateHistory"
12+
class="inline-block ml-4"
13+
v-bind:name="'history'"
14+
v-bind:starting-option="'People I viewed'"
15+
v-bind:options="['People I viewed', 'People I liked', 'Who viewed me', 'Who liked me', 'Whom I blocked']"></DropdownDisplayChoiceHistory>
16+
</div>
617
<HistoryRecommendations
718
v-if="firstTimeAnalysisDone"
8-
v-bind:ready="recommendationsAnalysisDone"
9-
v-on:update-history="updateHistory"
19+
v-bind:ready="recommendations.length"
1020
v-bind:title="'Potential matches'"
1121
v-bind:recommendationsReceived="recommendations"
1222
v-bind:recommendationsAnalysis="recommendationsAnalysis"></HistoryRecommendations>
@@ -19,13 +29,15 @@
1929
2030
import NavBar from '@/components/shared/NavBar.vue';
2131
import HistoryRecommendations from '@/components/app/recommendations/HistoryRecommendations.vue';
32+
import DropdownDisplayChoiceHistory from '@/components/shared/DropdownDisplayChoiceHistory.vue';
2233
2334
export default {
2435
name: 'History',
2536
props: ['recommendationsFromSettingUp'],
2637
components: {
2738
NavBar,
2839
HistoryRecommendations,
40+
DropdownDisplayChoiceHistory,
2941
},
3042
data: () => ({
3143
recommendations: [],
@@ -48,9 +60,23 @@ export default {
4860
firstTimeAnalysisDone: false,
4961
}),
5062
methods: {
51-
async fetchUsers() {
52-
const recommendationsRequest = await this.$http.get('/recommendations');
53-
this.recommendations = recommendationsRequest.data.recommendations;
63+
async fetchUsers(request) {
64+
if (request === 'People I viewed') {
65+
const recommendationsRequest = await this.$http.get('/history/viewed');
66+
this.recommendations = recommendationsRequest.data.viewed;
67+
} else if (request === 'People I liked') {
68+
const recommendationsRequest = await this.$http.get('/history/liked');
69+
this.recommendations = recommendationsRequest.data.liked;
70+
} else if (request === 'Who viewed me') {
71+
const recommendationsRequest = await this.$http.get('/history/viewed/me');
72+
this.recommendations = recommendationsRequest.data.viewed_me;
73+
} else if (request === 'Who liked me') {
74+
const recommendationsRequest = await this.$http.get('/history/liked/me');
75+
this.recommendations = recommendationsRequest.data.liked_me;
76+
} else if (request === 'Whom I blocked') {
77+
const recommendationsRequest = await this.$http.get('/history/blocked');
78+
this.recommendations = recommendationsRequest.data.bloked;
79+
}
5480
this.recommendations.sort((a, b) => a.distance - b.distance);
5581
for (let i = 0; i < this.recommendations.length; i += 1) {
5682
this.recommendations[i].distance = Math.floor(this.recommendations[i].distance);
@@ -100,29 +126,18 @@ export default {
100126
},
101127
updateHistory(...args) {
102128
const [request] = args;
103-
if (request === 'People I view') {
104-
console.log(1);
105-
} else if (request === 'People I like') {
106-
console.log(2);
107-
} else if (request === 'Who views me') {
108-
console.log(3);
109-
} else if (request === 'Who likes me') {
110-
console.log(4);
111-
} else if (request === 'Whom I block') {
112-
console.log(5);
113-
}
114129
this.browseAgain();
115-
this.fetchUsers();
130+
this.fetchUsers(request);
116131
},
117132
},
118133
async created() {
119-
await this.fetchUsers();
134+
await this.fetchUsers('People I viewed');
120135
},
121136
deactivated() {
122137
if (!this.$route.path.startsWith('/users')) {
123138
this.firstTimeAnalysisDone = false;
124139
this.browseAgain();
125-
this.fetchUsers();
140+
this.fetchUsers('People I viewed');
126141
this.$el.scrollTop = 0;
127142
}
128143
},

0 commit comments

Comments
 (0)