diff --git a/packages/react/src/views/AttachmentHandler/Attachment.js b/packages/react/src/views/AttachmentHandler/Attachment.js index 594bfa7d7..ec752e9bc 100644 --- a/packages/react/src/views/AttachmentHandler/Attachment.js +++ b/packages/react/src/views/AttachmentHandler/Attachment.js @@ -7,7 +7,7 @@ import AudioAttachment from './AudioAttachment'; import VideoAttachment from './VideoAttachment'; import TextAttachment from './TextAttachment'; -const Attachment = ({ attachment, host, type, variantStyles = {} }) => { +const Attachment = ({ attachment, host, type, variantStyles = {}, msg }) => { const author = { authorIcon: attachment?.author_icon, authorName: attachment?.author_name, @@ -19,6 +19,7 @@ const Attachment = ({ attachment, host, type, variantStyles = {} }) => { host={host} author={author} variantStyles={variantStyles} + msg={msg} /> ); } @@ -29,6 +30,7 @@ const Attachment = ({ attachment, host, type, variantStyles = {} }) => { host={host} author={author} variantStyles={variantStyles} + msg={msg} /> ); } @@ -39,6 +41,7 @@ const Attachment = ({ attachment, host, type, variantStyles = {} }) => { host={host} author={author} variantStyles={variantStyles} + msg={msg} /> ); } diff --git a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js index 428342ba1..5bd249ce5 100644 --- a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js +++ b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js @@ -1,8 +1,9 @@ import React from 'react'; import { css } from '@emotion/react'; import { ActionButton, Box } from '@embeddedchat/ui-elements'; +import { Markdown } from '../Markdown'; -const AttachmentMetadata = ({ attachment, url, variantStyles = {} }) => { +const AttachmentMetadata = ({ attachment, url, variantStyles = {}, msg }) => { const handleDownload = async () => { try { const response = await fetch(url); @@ -32,15 +33,25 @@ const AttachmentMetadata = ({ attachment, url, variantStyles = {} }) => { variantStyles.attachmentMetaContainer, ]} > -

- {attachment.description} -

+ {msg ? ( + + ) : ( + attachment.description + )} + { `} >

{attachment.title}

diff --git a/packages/react/src/views/AttachmentHandler/Attachments.js b/packages/react/src/views/AttachmentHandler/Attachments.js index 35010476a..f558ad5ec 100644 --- a/packages/react/src/views/AttachmentHandler/Attachments.js +++ b/packages/react/src/views/AttachmentHandler/Attachments.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import Attachment from './Attachment'; import RCContext from '../../context/RCInstance'; -const Attachments = ({ attachments, type, variantStyles = {} }) => { +const Attachments = ({ attachments, type, variantStyles = {}, msg }) => { const { RCInstance } = useContext(RCContext); let host = RCInstance.getHost(); host = host.replace(/\/$/, ''); @@ -15,6 +15,7 @@ const Attachments = ({ attachments, type, variantStyles = {} }) => { host={host} variantStyles={variantStyles} type={type} + msg={msg} /> )); }; diff --git a/packages/react/src/views/AttachmentHandler/AudioAttachment.js b/packages/react/src/views/AttachmentHandler/AudioAttachment.js index 0f5824aa0..b88d0a41d 100644 --- a/packages/react/src/views/AttachmentHandler/AudioAttachment.js +++ b/packages/react/src/views/AttachmentHandler/AudioAttachment.js @@ -5,7 +5,14 @@ import { Box, Avatar, useTheme } from '@embeddedchat/ui-elements'; import AttachmentMetadata from './AttachmentMetadata'; import RCContext from '../../context/RCInstance'; -const AudioAttachment = ({ attachment, host, type, author, variantStyles }) => { +const AudioAttachment = ({ + attachment, + host, + type, + author, + variantStyles, + msg, +}) => { const { RCInstance } = useContext(RCContext); const { theme } = useTheme(); const getUserAvatarUrl = (icon) => { @@ -58,6 +65,7 @@ const AudioAttachment = ({ attachment, host, type, author, variantStyles }) => { attachment={attachment} url={host + (attachment.title_url || attachment.audio_url)} variantStyles={variantStyles} + msg={msg} />
@@ -101,14 +126,32 @@ const AttachmentPreview = () => { > File description - { - handleFileDescription(e); - }} - value={fileDescription} - css={styles.input} - placeholder="Description" - /> + + + {showMembersList && ( + + )} + + { + handleFileDescription(e); + }} + css={styles.input} + placeholder="Description" + ref={messageRef} + /> + diff --git a/packages/react/src/views/AttachmentPreview/AttachmentPreview.styles.js b/packages/react/src/views/AttachmentPreview/AttachmentPreview.styles.js index 44729be84..45f8cf455 100644 --- a/packages/react/src/views/AttachmentPreview/AttachmentPreview.styles.js +++ b/packages/react/src/views/AttachmentPreview/AttachmentPreview.styles.js @@ -11,7 +11,7 @@ const getAttachmentPreviewStyles = () => { `, input: css` - width: 95.5%; + width: 100%; `, modalContent: css` @@ -19,6 +19,22 @@ const getAttachmentPreviewStyles = () => { overflow-x: hidden; max-height: 350px; `, + + fileDescription: css` + width: 100%; + position: relative; + z-index: 1300; + `, + + mentionListContainer: css` + position: absolute; + top: -100px; + width: 100%; + max-height: 100px; + overflow-y: auto; + background: white; + z-index: 1400; + `, }; return styles; diff --git a/packages/react/src/views/ChatInput/ChatInput.js b/packages/react/src/views/ChatInput/ChatInput.js index 86b4b5082..91fc98dec 100644 --- a/packages/react/src/views/ChatInput/ChatInput.js +++ b/packages/react/src/views/ChatInput/ChatInput.js @@ -469,18 +469,23 @@ const ChatInput = ({ scrollToBottom }) => { } /> ) : null} - - {showMembersList && ( - - )} + + {showMembersList && ( + + )} + {showCommandList && ( { +const Markdown = ({ body, md, isReaction = false }) => { const members = useMemberStore((state) => state.members); const username = useUserStore((state) => state.username); const value = useMemo(() => ({ members, username }), [members, username]); @@ -23,12 +23,12 @@ const Markdown = ({ body, isReaction = false }) => { ); } - if (!body || !body.md) return <>; + if (!body || !md) return <>; return ( - + ); diff --git a/packages/react/src/views/Mentions/MembersList.styles.js b/packages/react/src/views/Mentions/MembersList.styles.js index e288cae04..03bc8f401 100644 --- a/packages/react/src/views/Mentions/MembersList.styles.js +++ b/packages/react/src/views/Mentions/MembersList.styles.js @@ -3,7 +3,7 @@ import { css } from '@emotion/react'; const getMemberListStyles = (theme) => { const styles = { main: css` - margin: 0.2rem 2rem; + margin: 0.2rem 0rem; display: block; overflow: auto; max-height: 10rem; diff --git a/packages/react/src/views/Message/Message.js b/packages/react/src/views/Message/Message.js index a17a3c3a3..879532726 100644 --- a/packages/react/src/views/Message/Message.js +++ b/packages/react/src/views/Message/Message.js @@ -228,14 +228,19 @@ const Message = ({ > {message.attachments && message.attachments.length > 0 ? ( <> - + ) : ( - + )} {message.blocks && (