diff --git a/assets/src/components/conversations/ChatMessageBox.tsx b/assets/src/components/conversations/ChatMessageBox.tsx index 1c785a88f..32a747fc6 100644 --- a/assets/src/components/conversations/ChatMessageBox.tsx +++ b/assets/src/components/conversations/ChatMessageBox.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {Box, Flex} from 'theme-ui'; import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; -import {MarkdownRenderer, Text} from '../common'; +import {colors, MarkdownRenderer, Text} from '../common'; import {Attachment, Message, MessageSource} from '../../types'; import {PaperClipOutlined} from '../icons'; @@ -36,20 +36,42 @@ const ChatMessageAttachment = ({ color?: string; }) => { const {id, filename, file_url: fileUrl} = attachment; + const isImage = + filename.includes('.png') || + filename.includes('jpeg') || + filename.includes('.jpg'); return ( - - {' '} - - {filename} - - + + {isImage && ( + display image + )} + + + + {filename} + + + + ); }; @@ -87,17 +109,60 @@ const ChatMessageBox = ({ }); return ( - - {subject && ( - - - {subject} - - - )} + + {body && ( + + {subject && ( + + + {subject} + + + )} + - + {formattedSource && ( + + + {createdAt} + + + {sourceIcon && ( + {source} + )} + + Sent via {formattedSource} + + + + )} + + )} {attachments && attachments.length > 0 && ( {attachments.map((attachment) => { @@ -111,39 +176,6 @@ const ChatMessageBox = ({ })} )} - - {formattedSource && ( - - - {createdAt} - - - - {sourceIcon && ( - {source} - )} - - Sent via {formattedSource} - - - - )} ); };