Skip to content

Commit

Permalink
fix(call): show avatar in incoming call
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexZakablukov authored and stavares843 committed Jun 9, 2022
1 parent e342716 commit 3a11d04
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
21 changes: 7 additions & 14 deletions components/views/media/incomingCall/IncomingCall.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<div>
<div class="content">
<div class="gradient-cover" data-cy="incoming-call"></div>
<div v-if="callType === 'friend' && friend" class="caller--user">
<div
class="caller"
:class="callType === 'friend' ? 'caller--user' : 'caller--group'"
>
<div
class="user-profile-picture"
v-bind:style="`background:url(${friend.profilePicture})`"
v-bind:style="`background:url(${callerAvatar})`"
/>
<div class="user-info">
<p class="user-name">{{friend.name}}</p>
<p class="user-status">{{friend.status}}</p>
</div>
</div>
<div v-else-if="callType === 'group' && group" class="caller--group">
<div class="user-info">
<p class="user-name">{{group.name}}</p>
<p class="user-status">{{group.status}}</p>
<p class="user-name">{{caller.name}}</p>
<p class="user-status">{{caller.status}}</p>
</div>
<div
class="user-profile-picture"
v-bind:style="`background:url(${group.profilePicture})`"
/>
</div>
</div>
<footer class="modal-card-foot">
Expand Down
4 changes: 4 additions & 0 deletions components/views/media/incomingCall/IncomingCall.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
height: 400px;
}

.caller {
height: 100%;
}

.user-profile-picture {
background-size: cover !important;
background-position: center !important;
Expand Down
35 changes: 18 additions & 17 deletions components/views/media/incomingCall/IncomingCall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@ export default Vue.extend({
},
computed: {
...mapState(['conversation', 'groups', 'friends']),
group() {
return (
this.callType === 'group' &&
this.$store.state.groups.all.find(
(g: any) => g.id === this.$store.state.webrtc.incomingCall?.callId,
)
)
},
friend() {
return (
this.callType === 'friend' &&
this.$store.state.friends.all.find(
(f: any) =>
f.peerId === this.$store.state.webrtc.incomingCall?.callId,
)
)
},
callType() {
return this.$store.state.webrtc.incomingCall?.callId &&
RegExp(this.$Config.regex.uuidv4).test(
Expand All @@ -60,6 +43,24 @@ export default Vue.extend({
? 'group'
: 'friend'
},
caller() {
if (!this.callType) {
return
}
if (this.callType === 'friend') {
return this.$store.state.friends.all.find(
(f: any) =>
f.peerId === this.$store.state.webrtc.incomingCall?.callId,
)
}
return this.$store.state.groups.all.find(
(g: any) => g.id === this.$store.state.webrtc.incomingCall?.callId,
)
},
callerAvatar(): string {
const hash = this.caller?.profilePicture
return hash ? `${this.$Config.textile.browser}/ipfs/${hash}` : ''
},
},
watch: {
'$store.state.webrtc.incomingCall': {
Expand Down

0 comments on commit 3a11d04

Please sign in to comment.