1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<template>
<div class="main-view">
<LobbyScreen v-if="isInLobby" />
<template v-else>
<TopBar :is-in-call="showChatInSidebar" />
<transition name="fade">
<ChatView v-if="!showChatInSidebar" />
<template v-else>
<CallView :token="token" />
</template>
</transition>
</template>
</div>
</template>
<script>
import CallView from '../components/CallView/CallView.vue'
import ChatView from '../components/ChatView.vue'
import LobbyScreen from '../components/LobbyScreen.vue'
import TopBar from '../components/TopBar/TopBar.vue'
import isInLobby from '../mixins/isInLobby.js'
import isInCall from '../mixins/isInCall.js'
import participant from '../mixins/participant.js'
export default {
name: 'MainView',
components: {
ChatView,
LobbyScreen,
TopBar,
CallView,
},
mixins: [
isInLobby,
isInCall,
participant,
],
props: {
token: {
type: String,
required: true,
},
},
computed: {
conversation() {
return this.$store.getters.conversation(this.token)
},
showChatInSidebar() {
return this.isInCall
},
},
watch: {
isInLobby(isInLobby) {
// User is now blocked by the lobby
if (isInLobby && this.isInCall) {
this.$store.dispatch('leaveCall', {
token: this.token,
participantIdentifier: this.$store.getters.getParticipantIdentifier(),
})
}
},
},
}
</script>
<style lang="scss" scoped>
@import '../assets/variables';
.main-view {
height: 100%;
width: 100%;
display: flex;
flex-grow: 1;
flex-direction: column;
align-content: space-between;
}
</style>
|