Skip to content

Commit 160a9f2

Browse files
committed
view other user without image - display default image
1 parent b39caef commit 160a9f2

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

frontend/src/components/app/users/User.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<h1 class="noSelect">←</h1>
88
</div>
99
<div v-if="user" class="md:flex md:items-start">
10-
<UserImages v-bind:images="user.images" class="md:w-7/12 md:order-2 sm:rounded-t md:rounded-r-md md:rounded-l-none"></UserImages>
10+
<UserImages v-bind:images="user.images" v-bind:gender="user.gender" class="md:w-7/12 md:order-2 sm:rounded-t md:rounded-r-md md:rounded-l-none"></UserImages>
1111
<UserProfile class="md:w-5/12 md:order-1 md:overflow-scroll md:border-b md:border-l md:rounded-l-md" v-bind:user="user"></UserProfile>
1212
</div>
1313
</section>

frontend/src/components/app/users/UserImages.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<template>
2-
<!-- eslint-disable max-len-->
3-
<!-- v-for="(image, index) in this.images" :key="image.id"-->
42
<div
53
class="relative image-height"
64
v-bind:style="{
@@ -38,8 +36,12 @@
3836
</template>
3937

4038
<script>
39+
import imageMan from '../../../assets/recommendations/avatars/man1.png';
40+
import imageWoman from '../../../assets/recommendations/avatars/woman1.png';
41+
import imageOther from '../../../assets/recommendations/avatars/other.png';
42+
4143
export default {
42-
props: ['images'],
44+
props: ['images', 'gender'],
4345
data: () => ({
4446
currentImage: 0,
4547
imagesCount: 0,
@@ -59,7 +61,16 @@ export default {
5961
this.currentImage = index;
6062
},
6163
getImage() {
62-
return this.images[this.currentImage].link;
64+
if (this.images.length) {
65+
return this.images[this.currentImage].link;
66+
}
67+
if (this.gender === 'male') {
68+
return imageMan;
69+
}
70+
if (this.gender === 'female') {
71+
return imageWoman;
72+
}
73+
return imageOther;
6374
},
6475
},
6576
beforeMount() {

0 commit comments

Comments
 (0)