Skip to content

Commit

Permalink
fix: computed props in chat-task-time-row component[WTEL-4418]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Apr 25, 2024
1 parent 1a36b05 commit e4ab2aa
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,31 @@
</timeline-row-info>
</template>

<template v-slot:pin>
<template #pin="{ toggle, collapsed }">
<timeline-pin
:collapsed="collapsed"
:type="taskType"
@click="toggle"
></timeline-pin>
</template>

<template v-slot:content>
<div class="chat-task-timeline-row__content">
<div class="chat-task-timeline-row__wrapper">
<div class="call-task-timeline-row__content">
<div class="call-task-timeline-row__wrapper">
<timeline-row-initiator
:type="taskType"
:text="taskInitiator.name"
></timeline-row-initiator>

<wt-chip
v-if="hiddenUsers.length"
@click="openHiddenUsers = !openHiddenUsers"
>{{ +hiddenUsers.lenght }}
v-if="hiddenParticipants.length"
@click="openHiddenParticipants = !openHiddenParticipants"
>{{ +hiddenParticipants.lenght }}
</wt-chip>

<div v-if="openHiddenUsers">
<div v-if="openHiddenParticipants">
<timeline-row-initiator
v-for="user of hiddenUsers"
v-for="user of hiddenParticipants"
:text="user.name"
></timeline-row-initiator>
</div>
Expand All @@ -46,7 +48,7 @@
:duration="duration"
></timeline-row-duration>

</div>
</div>

<call-task-timeline-actions
v-if="taskType !== TimelinePinTypeEnum.CHAT"
Expand All @@ -62,7 +64,6 @@

<script setup>
import { computed, toRefs, ref } from 'vue';
import { WebitelContactsTimelineEventType } from 'webitel-sdk';
import TimelinePinTypeEnum from '../../enums/TimelinePinType.enum.js';
import TimelineTaskStatusEnum from '../../enums/TimelineTaskStatus.enum.js';
import TimelinePin from '../utils/timeline-pin.vue';
Expand All @@ -83,29 +84,24 @@ const props = defineProps({
const {
createdAt,
participants,
type,
isInbound,
isMissed,
duration,
flowScheme,
queue,
id,
} = toRefs(props.task);
const openHiddenUsers = ref(false);
const openHiddenParticipants = ref(false);
const taskType = computed(() => {
if (type.value === WebitelContactsTimelineEventType.Chat) {
return TimelinePinTypeEnum.CHAT;
} else {
if(isInbound.value) {
if (isMissed?.value) {
if (queue?.value) return TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE;
return TimelinePinTypeEnum.CALL_MISSED;
return queue?.value ? TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE : TimelinePinTypeEnum.CALL_MISSED;
} else {
if (!queue?.value) return TimelinePinTypeEnum.CALL_INBOUND_ON_IVR;
return TimelinePinTypeEnum.CALL_INBOUND;
return !queue?.value ? TimelinePinTypeEnum.CALL_INBOUND_ON_IVR : TimelinePinTypeEnum.CALL_INBOUND;
}
return TimelinePinTypeEnum.CALL_OUTBOUND;
}
} return TimelinePinTypeEnum.CALL_OUTBOUND;
});
const taskStatus = computed(() => taskType.value.includes(TimelinePinTypeEnum.CALL_MISSED)
Expand All @@ -123,11 +119,11 @@ const taskInitiator = computed(() => {
}
});
const hiddenUsers = computed(() => participants.value.filter(participant => participant.id !== taskInitiator.value.id));
const hiddenParticipants = computed(() => participants?.value?.filter(participant => participant.id !== taskInitiator.value.id));
</script>
<style lang="scss" scoped>
.chat-task-timeline-row {
.call-task-timeline-row {
&__content {
display: flex;
gap: var(--spacing-sm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<script setup>
import { computed } from 'vue';
import TimelinePinType from '../../enums/TimelinePinType.enum.js';
import TimelinePinTypeEnum from '../../enums/TimelinePinType.enum.js';
import TimelineSeparator from './timeline-separator.vue';
const props = defineProps({
Expand All @@ -36,51 +36,51 @@ const emit = defineEmits([
]);
const stateMap = {
[TimelinePinType.DAY]: {
[TimelinePinTypeEnum.DAY]: {
component: 'wt-button',
color: 'secondary',
},
[TimelinePinType.CLOSE]: {
[TimelinePinTypeEnum.CLOSE]: {
component: 'wt-rounded-action',
icon: 'close',
rounded: true,
},
[TimelinePinType.CHAT]: {
[TimelinePinTypeEnum.CHAT]: {
component: 'wt-rounded-action',
color: 'chat',
icon: 'chat',
filled: true,
rounded: true,
},
[TimelinePinType.CALL_INBOUND]: {
[TimelinePinTypeEnum.CALL_INBOUND]: {
component: 'wt-rounded-action',
color: 'primary',
icon: 'call-inbound',
filled: true,
rounded: true,
},
[TimelinePinType.CALL_OUTBOUND]: {
[TimelinePinTypeEnum.CALL_OUTBOUND]: {
component: 'wt-rounded-action',
color: 'success',
icon: 'call-outbound',
filled: true,
rounded: true,
},
[TimelinePinType.CALL_MISSED]: {
[TimelinePinTypeEnum.CALL_MISSED]: {
component: 'wt-rounded-action',
color: 'error',
icon: 'call-missed',
filled: true,
rounded: true,
},
[TimelinePinType.CALL_INBOUND_ON_IVR]: {
[TimelinePinTypeEnum.CALL_INBOUND_ON_IVR]: {
component: 'wt-rounded-action',
color: 'primary',
icon: 'call-inbound',
filled: true,
rounded: true,
},
[TimelinePinType.CALL_MISSED_ON_QUEUE]: {
[TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE]: {
component: 'wt-rounded-action',
color: 'error',
icon: 'call-missed',
Expand All @@ -91,8 +91,8 @@ const stateMap = {
};
const state = computed(() => {
if(props.type === TimelinePinType.DAY) return stateMap[TimelinePinType.DAY];
return props.collapsed ? stateMap[props.type] : stateMap[TimelinePinType.CLOSE];
if(props.type === TimelinePinTypeEnum.DAY) return stateMap[TimelinePinTypeEnum.DAY];
return props.collapsed ? stateMap[props.type] : stateMap[TimelinePinTypeEnum.CLOSE];
});
const handleClick = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<template>
<div class="timeline-row-initiator">
<div v-if="type === TimelinePinTypeEnum.CALL_INBOUND_ON_IVR">
<wt-icon
icon="bot"
></wt-icon>
<div
v-if="isDisplayBotName"
class="timeline-row-initiator-bot"
>
<div class="timeline-row-initiator-bot__icon">
<wt-icon
icon="bot"
></wt-icon>

</div>
<p>{{ text }}</p>
</div>

<div v-else-if="type === TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE">
<div v-else-if="isDisplayFlowSchemeName">
<wt-chip
color="secondary"
>{{text}}</wt-chip>
Expand All @@ -26,6 +32,7 @@

<script setup>
import TimelinePinTypeEnum from '../../enums/TimelinePinType.enum.js';
import { computed } from 'vue';
const props = defineProps({
text: {
Expand All @@ -36,16 +43,35 @@ const props = defineProps({
type: String,
}
});
const isDisplayBotName = computed(() => props.type === TimelinePinTypeEnum.CALL_INBOUND_ON_IVR || props.type === TimelinePinTypeEnum.CHAT_GATEWAY);
const isDisplayFlowSchemeName = computed(() => props.type === TimelinePinTypeEnum.CALL_MISSED_ON_QUEUE);
</script>

<style lang="scss" scoped>
.timeline-row-initiator-user {
display: flex;
align-items: center;
gap: var(--spacing-xs);
.timeline-row-initiator {
&-user {
display: flex;
align-items: center;
gap: var(--spacing-xs);
&__name {
@extend %typo-subtitle-1;
&__name {
@extend %typo-subtitle-1;
}
}
&-bot {
display: flex;
gap: var(--spacing-xs);
align-items: center;
&__icon {
background-color: var(--secondary-color);
padding: var(--spacing-xs);
border-radius: 50%;
height: 40px; ///?
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ const TimelinePinType = Object.freeze({
DAY: 'DAY',
CLOSE: 'CLOSE',
CHAT: 'CHAT',
CHAT_GATEWAY: 'CHAT_GATEWAY',
CALL_INBOUND: 'CALL_INBOUND',
CALL_INBOUND_ON_IVR: 'CALL_INBOUND_ON_IVR',
CALL_OUTBOUND: 'CALL_OUTBOUND',
CALL_MISSED: 'CALL_MISSED',
CALL_INBOUND_ON_IVR: 'CALL_INBOUND_ON_IVR',
CALL_MISSED_ON_QUEUE: 'CALL_MISSED_ON_QUEUE',

CALL_TRANSFER: 'CALL_TRANSFER',
Expand Down
Loading

0 comments on commit e4ab2aa

Please sign in to comment.