2021-10-17 21:01:14 +02:00
|
|
|
<template>
|
|
|
|
<div class="user-picture">
|
|
|
|
<img
|
|
|
|
v-if="authUserPictureUrl !== ''"
|
2021-11-01 20:48:22 +01:00
|
|
|
class="profile-user-img"
|
2021-10-20 17:38:25 +02:00
|
|
|
:alt="$t('user.USER_PICTURE')"
|
2021-10-17 21:01:14 +02:00
|
|
|
:src="authUserPictureUrl"
|
|
|
|
/>
|
|
|
|
<div v-else class="no-picture">
|
|
|
|
<i class="fa fa-user-circle-o" aria-hidden="true" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { PropType, computed, defineComponent } from 'vue'
|
|
|
|
|
2021-10-30 12:01:55 +02:00
|
|
|
import { IUserProfile } from '@/types/user'
|
2021-10-17 21:01:14 +02:00
|
|
|
import { getApiUrl } from '@/utils'
|
2021-10-20 17:38:25 +02:00
|
|
|
|
2021-10-17 21:01:14 +02:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'UserPicture',
|
|
|
|
props: {
|
|
|
|
user: {
|
2021-10-30 12:01:55 +02:00
|
|
|
type: Object as PropType<IUserProfile>,
|
2021-10-17 21:01:14 +02:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setup(props) {
|
|
|
|
return {
|
|
|
|
authUserPictureUrl: computed(() =>
|
|
|
|
props.user.picture
|
2021-11-01 20:48:22 +01:00
|
|
|
? `${getApiUrl()}users/${props.user.username}/picture`
|
2021-10-17 21:01:14 +02:00
|
|
|
: ''
|
|
|
|
),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import '~@/scss/base.scss';
|
|
|
|
|
|
|
|
.user-picture {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
min-width: 30%;
|
|
|
|
img {
|
|
|
|
border-radius: 50%;
|
|
|
|
height: 90px;
|
|
|
|
width: 90px;
|
|
|
|
}
|
|
|
|
.no-picture {
|
|
|
|
color: var(--app-a-color);
|
|
|
|
font-size: 5.5em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|