diff --git a/app/javascript/dashboard/components-next/message/Message.vue b/app/javascript/dashboard/components-next/message/Message.vue index a3d5df015..63a779a7a 100644 --- a/app/javascript/dashboard/components-next/message/Message.vue +++ b/app/javascript/dashboard/components-next/message/Message.vue @@ -117,7 +117,7 @@ const props = defineProps({ }, conversationId: { type: Number, required: true }, createdAt: { type: Number, required: true }, // eslint-disable-line vue/no-unused-properties - currentUserId: { type: Number, required: true }, + currentUserId: { type: Number, required: true }, // eslint-disable-line vue/no-unused-properties groupWithNext: { type: Boolean, default: false }, inboxId: { type: Number, default: null }, // eslint-disable-line vue/no-unused-properties inboxSupportsReplyTo: { type: Object, default: () => ({}) }, @@ -173,7 +173,10 @@ const variant = computed(() => { return variants[props.messageType] || MESSAGE_VARIANTS.USER; }); -const isMyMessage = computed(() => { +const isBotOrAgentMessage = computed(() => { + if (props.messageType === MESSAGE_TYPES.ACTIVITY) { + return false; + } // if an outgoing message is still processing, then it's definitely a // message sent by the current user if ( @@ -186,13 +189,10 @@ const isMyMessage = computed(() => { const senderType = props.senderType ?? props.sender?.type; if (!senderType || !senderId) { - return false; + return true; } - return ( - senderType.toLowerCase() === SENDER_TYPES.USER.toLowerCase() && - props.currentUserId === senderId - ); + return senderType.toLowerCase() === SENDER_TYPES.USER.toLowerCase(); }); /** @@ -200,7 +200,7 @@ const isMyMessage = computed(() => { * @returns {import('vue').ComputedRef<'left'|'right'|'center'>} The computed orientation */ const orientation = computed(() => { - if (isMyMessage.value) { + if (isBotOrAgentMessage.value) { return ORIENTATION.RIGHT; } @@ -221,8 +221,8 @@ const flexOrientationClass = computed(() => { const gridClass = computed(() => { const map = { - [ORIENTATION.LEFT]: 'grid grid-cols-[24px_1fr]', - [ORIENTATION.RIGHT]: 'grid grid-cols-1fr', + [ORIENTATION.LEFT]: 'grid grid-cols-1fr', + [ORIENTATION.RIGHT]: 'grid grid-cols-[1fr_24px]', }; return map[orientation.value]; @@ -231,13 +231,13 @@ const gridClass = computed(() => { const gridTemplate = computed(() => { const map = { [ORIENTATION.LEFT]: ` - "avatar bubble" - "spacer meta" - `, - [ORIENTATION.RIGHT]: ` "bubble" "meta" `, + [ORIENTATION.RIGHT]: ` + "bubble avatar" + "meta spacer" + `, }; return map[orientation.value]; @@ -251,7 +251,7 @@ const shouldGroupWithNext = computed(() => { const shouldShowAvatar = computed(() => { if (props.messageType === MESSAGE_TYPES.ACTIVITY) return false; - if (orientation.value === ORIENTATION.RIGHT) return false; + if (orientation.value === ORIENTATION.LEFT) return false; return true; }); @@ -444,7 +444,7 @@ provideMessageContext({ isPrivate: computed(() => props.private), variant, orientation, - isMyMessage, + isBotOrAgentMessage, shouldGroupWithNext, }); @@ -476,14 +476,14 @@ provideMessageContext({ 'w-full': variant === MESSAGE_VARIANTS.EMAIL, }, ]" - class="gap-x-3" + class="gap-x-2" :style="{ gridTemplateAreas: gridTemplate, }" >