2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
2021-03-02 17:14:04 +00:00
|
|
|
<div class="conversation-details-wrap">
|
|
|
|
<conversation-header
|
2019-11-17 07:39:10 +00:00
|
|
|
v-if="currentChat.id"
|
2021-03-02 17:14:04 +00:00
|
|
|
:chat="currentChat"
|
2019-11-17 07:39:10 +00:00
|
|
|
:is-contact-panel-open="isContactPanelOpen"
|
2020-08-17 05:55:13 +00:00
|
|
|
@contact-panel-toggle="onToggleContactPanel"
|
2019-12-16 12:53:14 +00:00
|
|
|
/>
|
2021-03-02 17:14:04 +00:00
|
|
|
<div class="messages-and-sidebar">
|
|
|
|
<messages-view
|
|
|
|
v-if="currentChat.id"
|
|
|
|
:inbox-id="inboxId"
|
|
|
|
:is-contact-panel-open="isContactPanelOpen"
|
|
|
|
@contact-panel-toggle="onToggleContactPanel"
|
|
|
|
/>
|
|
|
|
<empty-state v-else />
|
|
|
|
|
|
|
|
<div v-show="showContactPanel" class="conversation-sidebar-wrap">
|
|
|
|
<contact-panel
|
|
|
|
v-if="showContactPanel"
|
|
|
|
:conversation-id="currentChat.id"
|
2021-04-09 09:02:29 +00:00
|
|
|
:inbox-id="currentChat.inbox_id"
|
2021-03-02 17:14:04 +00:00
|
|
|
:on-toggle="onToggleContactPanel"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
2021-03-02 17:14:04 +00:00
|
|
|
import ContactPanel from 'dashboard/routes/dashboard/conversation/ContactPanel';
|
|
|
|
import ConversationHeader from './ConversationHeader';
|
2019-11-17 07:39:10 +00:00
|
|
|
import EmptyState from './EmptyState';
|
|
|
|
import MessagesView from './MessagesView';
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
export default {
|
2019-08-25 05:34:33 +00:00
|
|
|
components: {
|
2019-11-17 07:39:10 +00:00
|
|
|
EmptyState,
|
|
|
|
MessagesView,
|
2021-03-02 17:14:04 +00:00
|
|
|
ContactPanel,
|
|
|
|
ConversationHeader,
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
inboxId: {
|
2019-09-02 14:56:28 +00:00
|
|
|
type: [Number, String],
|
2019-11-17 07:39:10 +00:00
|
|
|
default: '',
|
|
|
|
required: false,
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2019-11-14 08:16:43 +00:00
|
|
|
isContactPanelOpen: {
|
|
|
|
type: Boolean,
|
2021-08-11 06:25:55 +00:00
|
|
|
default: true,
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2019-08-25 05:34:33 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
computed: {
|
2021-08-02 10:37:30 +00:00
|
|
|
...mapGetters({ currentChat: 'getSelectedChat' }),
|
2021-03-02 17:14:04 +00:00
|
|
|
showContactPanel() {
|
|
|
|
return this.isContactPanelOpen && this.currentChat.id;
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
2021-04-09 09:02:29 +00:00
|
|
|
watch: {
|
|
|
|
'currentChat.inbox_id'(inboxId) {
|
|
|
|
if (inboxId) {
|
2021-04-22 17:47:29 +00:00
|
|
|
this.$store.dispatch('inboxAssignableAgents/fetch', { inboxId });
|
2021-04-09 09:02:29 +00:00
|
|
|
}
|
|
|
|
},
|
2021-11-15 11:52:44 +00:00
|
|
|
'currentChat.id'() {
|
|
|
|
this.fetchLabels();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchLabels();
|
2021-04-09 09:02:29 +00:00
|
|
|
},
|
2019-08-25 05:34:33 +00:00
|
|
|
methods: {
|
2021-11-15 11:52:44 +00:00
|
|
|
fetchLabels() {
|
|
|
|
if (!this.currentChat.id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$store.dispatch('conversationLabels/get', this.currentChat.id);
|
|
|
|
},
|
2019-11-14 08:16:43 +00:00
|
|
|
onToggleContactPanel() {
|
2020-08-17 05:55:13 +00:00
|
|
|
this.$emit('contact-panel-toggle');
|
2019-11-14 08:16:43 +00:00
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
2021-03-02 17:14:04 +00:00
|
|
|
<style lang="scss" scoped>
|
2021-05-20 08:21:46 +00:00
|
|
|
@import '~dashboard/assets/scss/woot';
|
2021-03-02 17:14:04 +00:00
|
|
|
|
|
|
|
.conversation-details-wrap {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2021-05-07 12:58:47 +00:00
|
|
|
min-width: 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
width: 100%;
|
|
|
|
border-left: 1px solid var(--color-border);
|
2021-03-15 13:05:56 +00:00
|
|
|
background: var(--color-background-light);
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.messages-and-sidebar {
|
|
|
|
display: flex;
|
|
|
|
background: var(--color-background-light);
|
|
|
|
margin: 0;
|
2022-03-15 15:39:14 +00:00
|
|
|
height: 100%;
|
|
|
|
min-height: 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.conversation-sidebar-wrap {
|
|
|
|
height: auto;
|
2021-03-08 08:00:33 +00:00
|
|
|
flex: 0 0;
|
2021-03-02 17:14:04 +00:00
|
|
|
overflow: hidden;
|
|
|
|
overflow: auto;
|
|
|
|
background: white;
|
|
|
|
flex-basis: 28rem;
|
|
|
|
|
|
|
|
@include breakpoint(large up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 30em;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xlarge up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 31em;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xxlarge up) {
|
2021-03-08 08:00:33 +00:00
|
|
|
flex-basis: 33rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@include breakpoint(xxxlarge up) {
|
|
|
|
flex-basis: 40rem;
|
2021-03-02 17:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&::v-deep .contact--panel {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|