|
@@ -12,7 +12,7 @@
|
|
|
<v-expansion-panel-header>
|
|
|
<span>Meeting Room</span>
|
|
|
<v-spacer></v-spacer>
|
|
|
- <v-btn v-if="meeting.uid" color="purple" small ripple outlined class="mr-3" @click.stop="leaveMeeting">Leave</v-btn>
|
|
|
+ <v-btn :disabled="meetingLoading" v-if="meeting.uid" color="purple" small ripple outlined class="mr-3" @click.stop="leaveMeeting">Leave</v-btn>
|
|
|
</v-expansion-panel-header>
|
|
|
<v-expansion-panel-content>
|
|
|
<meeting-room></meeting-room>
|
|
@@ -33,21 +33,21 @@
|
|
|
</v-expansion-panel-content>
|
|
|
</v-expansion-panel>
|
|
|
</v-expansion-panels>
|
|
|
- <call-bubble :call="incomingCallDetails"></call-bubble>
|
|
|
+ <call-bubble></call-bubble>
|
|
|
</v-app>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapState } from "vuex";
|
|
|
-import VueSocketIO from "vue-socket.io";
|
|
|
-import SocketIO from "socket.io-client";
|
|
|
+import { mapState } from "vuex"
|
|
|
+import VueSocketIO from "vue-socket.io"
|
|
|
+import SocketIO from "socket.io-client"
|
|
|
|
|
|
Vue.use(
|
|
|
new VueSocketIO({
|
|
|
debug: true,
|
|
|
connection: SocketIO(process.env.MIX_SOCKET_SERVICE_URL)
|
|
|
})
|
|
|
-);
|
|
|
+)
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
@@ -62,23 +62,21 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
active_panel: [0, 1, 2],
|
|
|
- incomingCallDetails: null,
|
|
|
- lobbies: []
|
|
|
- };
|
|
|
+ lobbies_: []
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(["user", "meeting"])
|
|
|
+ ...mapState(["user", "meeting", "lobbies", "meetingLoading"])
|
|
|
},
|
|
|
watch: {
|
|
|
meeting: {
|
|
|
handler(newVal, oldVal) {
|
|
|
if (oldVal && oldVal.uid) {
|
|
|
- this.$socket.emit("meetingLeft", { lobby_uid: oldVal.lobby_uid, meeting_name: oldVal.name, meeting_uid: oldVal.uid, user: this.user });
|
|
|
+ this.$socket.emit("meetingLeft", { lobby_uid: oldVal.lobby_uid, meeting_name: oldVal.name, meeting_uid: oldVal.uid, user: this.user })
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (newVal && newVal.uid) {
|
|
|
- this.$socket.emit("meetingJoined", { lobby_uid: newVal.lobby_uid, meeting_name: newVal.name, meeting_uid: newVal.uid, user: this.user });
|
|
|
+ this.$socket.emit("meetingJoined", { lobby_uid: newVal.lobby_uid, meeting_name: newVal.name, meeting_uid: newVal.uid, user: this.user })
|
|
|
|
|
|
this.$eventBus.$emit("updateMeetingMessages")
|
|
|
/* axios
|
|
@@ -86,54 +84,90 @@ export default {
|
|
|
.then(response => {
|
|
|
this.messages = response.data.map(cur => {
|
|
|
// cur.id = cur.message_id
|
|
|
- cur.timestamp_formatted = timeago.format(cur.timestamp);
|
|
|
+ cur.timestamp_formatted = timeago.format(cur.timestamp)
|
|
|
|
|
|
// cur.user = {
|
|
|
// name: cur.name,
|
|
|
// UID: cur.user_uid,
|
|
|
// avatarFile: cur.avatarSrc || null
|
|
|
// }
|
|
|
- cur.sent = this.user.UID == cur.user.UID ? true : false;
|
|
|
+ cur.sent = this.user.UID == cur.user.UID ? true : false
|
|
|
|
|
|
// delete cur.message_id
|
|
|
// delete cur.name
|
|
|
// delete cur.user_uid
|
|
|
|
|
|
- return cur;
|
|
|
- });
|
|
|
+ return cur
|
|
|
+ })
|
|
|
})
|
|
|
.catch(e => {
|
|
|
- console.log(e);
|
|
|
- }); */
|
|
|
+ console.log(e)
|
|
|
+ }) */
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
sockets: {
|
|
|
- incomingCall: function(data) {
|
|
|
- let self = this;
|
|
|
+ incomingCall: function(data){
|
|
|
+ let self = this
|
|
|
|
|
|
- if (!data.time_limit) {
|
|
|
- data.time_limit = 10;
|
|
|
+ this.$store.commit('setCall', data)
|
|
|
+ },
|
|
|
+ disconnect: function(){
|
|
|
+ this.$store.commit("nullifyMeetingsOnline")
|
|
|
+ },
|
|
|
+ reconnect: function(){
|
|
|
+ this.$socket.emit("userData", {
|
|
|
+ user: this.user,
|
|
|
+ meeting: this.meeting,
|
|
|
+ lobbies_uid_list: this.lobbies.reduce((acc, cur) => { return [...acc, cur.uid] }, [])
|
|
|
+ })
|
|
|
+
|
|
|
+ if (this.meeting.uid) {
|
|
|
+ this.$socket.emit("meetingJoined", { lobby_uid: this.meeting.lobby_uid, meeting_uid: this.meeting.uid, user: this.user })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'call-data': function(data){
|
|
|
+ if(data.callData && data.state == null){
|
|
|
+ this.$store.commit("setCall", data.callData)
|
|
|
}
|
|
|
|
|
|
- self.incomingCallDetails = data;
|
|
|
+ this.$socket.emit("lobbyDataRequest")
|
|
|
+ },
|
|
|
+ 'lobby-data': function(data){
|
|
|
+ for (let meeting of data.meetings) {
|
|
|
+ this.$store.commit("setLobbyActivity", meeting)
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- let timer = setInterval(() => {
|
|
|
- if (self.incomingCallDetails.time_limit > 0) {
|
|
|
- self.incomingCallDetails.time_limit--;
|
|
|
+ /* Meeting Handlers */
|
|
|
|
|
|
- if (self.incomingCallDetails.time_limit == 0) {
|
|
|
- clearInterval(timer);
|
|
|
- console.log("TIME IS OUT!");
|
|
|
- }
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
+ 'meeting-activity': function(data){
|
|
|
+ this.$store.commit("setLobbyActivity", data)
|
|
|
},
|
|
|
- reconnect: function() {
|
|
|
- if (this.meeting.uid) {
|
|
|
- this.$socket.emit("meetingJoined", { lobby_uid: this.meeting.lobby_uid, meeting_uid: this.meeting.uid, user: this.user });
|
|
|
- }
|
|
|
+ 'meeting-created': function(data){
|
|
|
+ this.$store.commit("addNewMeetingInLobby", data)
|
|
|
+ },
|
|
|
+ 'meeting-updated': function(data){
|
|
|
+ this.$store.commit("setUpdatedMeetingInLobby", data)
|
|
|
+ },
|
|
|
+ 'meeting-closed': function(data){
|
|
|
+ this.$store.dispatch("leaveMeeting");
|
|
|
+ },
|
|
|
+
|
|
|
+ /* Lobby Handlers */
|
|
|
+
|
|
|
+ 'lobby-updated': function(data){
|
|
|
+ this.$store.commit("updateLobby", data)
|
|
|
+ },
|
|
|
+ 'lobby-activated': function(data){
|
|
|
+ this.$store.commit("activateLobby", data)
|
|
|
+ },
|
|
|
+ 'lobby-deactivated': function(data){
|
|
|
+ this.$store.commit("deactivateLobby", data)
|
|
|
+ },
|
|
|
+ 'lobby-created-for-pro': function(data){
|
|
|
+ this.$store.commit("addNewLobby", data)
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -142,16 +176,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- let lobbies = this.userProp.lobbies;
|
|
|
- delete this.userProp.lobbies;
|
|
|
+ let lobbies = this.userProp.lobbies
|
|
|
+ delete this.userProp.lobbies
|
|
|
|
|
|
lobbies.map(lobby => {
|
|
|
- lobby.selected_meeting = null;
|
|
|
+ lobby.selected_meeting = null
|
|
|
lobby.meetings.map(meeting => {
|
|
|
- meeting.active_members = [];
|
|
|
- meeting.pros_online = [];
|
|
|
- });
|
|
|
- });
|
|
|
+ meeting.active_members = []
|
|
|
+ meeting.pros_online = []
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
if (this.meetingProp) {
|
|
|
let meeting = {
|
|
@@ -161,67 +195,23 @@ export default {
|
|
|
active_members: [],
|
|
|
pros_online: []
|
|
|
}
|
|
|
- this.$store.commit("setCurrentMeeting", meeting);
|
|
|
+ this.$store.commit("setCurrentMeeting", meeting)
|
|
|
}
|
|
|
|
|
|
this.$socket.emit("userData", {
|
|
|
user: this.userProp,
|
|
|
meeting: this.meeting,
|
|
|
- lobbies_uid_list: lobbies.reduce((acc, cur) => { console.log(cur); return [...acc, cur.uid] }, [])
|
|
|
+ lobbies_uid_list: lobbies.reduce((acc, cur) => { return [...acc, cur.uid] }, [])
|
|
|
})
|
|
|
|
|
|
- this.$store.commit("setInitialUser", this.userProp);
|
|
|
- this.$store.commit("setLobbies", lobbies);
|
|
|
-
|
|
|
- this.$socket.emit("lobbyDataRequest", lobbies);
|
|
|
-
|
|
|
- this.sockets.subscribe("lobby-data", data => {
|
|
|
- for (let meeting of Object.values(data.meetings)) {
|
|
|
- this.$store.commit("setLobbyActivity", meeting);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- /* Meeting Handlers */
|
|
|
-
|
|
|
- this.sockets.subscribe("meeting-activity", data => {
|
|
|
- this.$store.commit("setLobbyActivity", data)
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("meeting-created", data => {
|
|
|
- this.$store.commit("addNewMeetingInLobby", data);
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("meeting-updated", data => {
|
|
|
- this.$store.commit("setUpdatedMeetingInLobby", data);
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("meeting-closed", data => {
|
|
|
- this.$eventBus.$emit("leaveMeeting")
|
|
|
- })
|
|
|
-
|
|
|
- /* Lobby Handlers */
|
|
|
-
|
|
|
- this.sockets.subscribe("lobby-updated", data => {
|
|
|
- this.$store.commit("updateLobby", data)
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("lobby-activated", data => {
|
|
|
- this.$store.commit("activateLobby", data);
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("lobby-deactivated", data => {
|
|
|
- this.$store.commit("deactivateLobby", data);
|
|
|
- })
|
|
|
-
|
|
|
- this.sockets.subscribe("lobby-created-for-pro", data => {
|
|
|
- this.$store.commit("addNewLobby", data);
|
|
|
- })
|
|
|
+ this.$store.commit("setInitialUser", this.userProp)
|
|
|
+ this.$store.commit("setLobbies", lobbies)
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
.v-expansion-panel-content__wrap {
|
|
|
- padding: 24px 16px;
|
|
|
+ padding: 24px 16px
|
|
|
}
|
|
|
</style>
|