[Enhancement] Add default avatar when profile image is not available (#188)
* Add default avatar when agent image is not available * Remove fonts from avatar Separate non-computed style values
This commit is contained in:
committed by
Sojan Jose
parent
16fe912fbd
commit
e32b6bf6d4
@@ -1,7 +1,26 @@
|
||||
<template>
|
||||
<div class="user-thumbnail-box" v-bind:style="{ height: size, width: size }">
|
||||
<img v-bind:src="src" class="user-thumbnail">
|
||||
<img class="source-badge" src="~dashboard/assets/images/fb-badge.png" v-if="badge === 'Facebook'">
|
||||
<div class="user-thumbnail-box" :style="{ height: size, width: size }">
|
||||
<img
|
||||
v-if="!imgError && Boolean(src)"
|
||||
id="image"
|
||||
:src="src"
|
||||
class="user-thumbnail"
|
||||
@error="onImgError()"
|
||||
/>
|
||||
<Avatar
|
||||
v-else
|
||||
:username="username"
|
||||
class="user-thumbnail"
|
||||
background-color="#1f93ff"
|
||||
color="white"
|
||||
>
|
||||
</Avatar>
|
||||
<img
|
||||
v-if="badge === 'Facebook'"
|
||||
id="badge"
|
||||
class="source-badge"
|
||||
src="~dashboard/assets/images/fb-badge.png"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -10,8 +29,14 @@
|
||||
* Src - source for round image
|
||||
* Size - Size of the thumbnail
|
||||
* Badge - Chat source indication { fb / telegram }
|
||||
* Username - User name for avatar
|
||||
*/
|
||||
import Avatar from './Avatar';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Avatar,
|
||||
},
|
||||
props: {
|
||||
src: {
|
||||
type: String,
|
||||
@@ -24,6 +49,19 @@ export default {
|
||||
type: String,
|
||||
default: 'fb',
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgError: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onImgError() {
|
||||
this.imgError = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user