diff --git a/app/soapbox/features/chats/components/chat-composer.tsx b/app/soapbox/features/chats/components/chat-composer.tsx index 1d335d566..f2c40ca14 100644 --- a/app/soapbox/features/chats/components/chat-composer.tsx +++ b/app/soapbox/features/chats/components/chat-composer.tsx @@ -43,6 +43,7 @@ interface IChatComposer extends Pick void resetFileKey: number | null attachments?: Attachment[] + onDeleteAttachment?: () => void } /** Textarea input for chats. */ @@ -57,6 +58,7 @@ const ChatComposer = React.forwardRef resetFileKey, onPaste, attachments = [], + onDeleteAttachment, }, ref) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -186,6 +188,7 @@ const ChatComposer = React.forwardRef maxRows={5} disabled={disabled} attachments={attachments} + onDeleteAttachment={onDeleteAttachment} /> {isSuggestionsAvailable ? ( diff --git a/app/soapbox/features/chats/components/chat-textarea.tsx b/app/soapbox/features/chats/components/chat-textarea.tsx index c26755cf5..e2ade90d3 100644 --- a/app/soapbox/features/chats/components/chat-textarea.tsx +++ b/app/soapbox/features/chats/components/chat-textarea.tsx @@ -3,12 +3,15 @@ import React from 'react'; import { Textarea } from 'soapbox/components/ui'; import { Attachment } from 'soapbox/types/entities'; +import ChatUpload from './chat-upload'; + interface IChatTextarea extends React.ComponentProps { attachments?: Attachment[] + onDeleteAttachment?: () => void } /** Custom textarea for chats. */ -const ChatTextarea: React.FC = ({ attachments, ...rest }) => { +const ChatTextarea: React.FC = ({ attachments, onDeleteAttachment, ...rest }) => { return (
= ({ attachments, ...rest }) => { dark:focus-within:ring-primary-500 dark:focus-within:border-primary-500 `} > - {attachments?.map(attachment => ( - - ))} + {(!!attachments?.length) && ( +
+ {attachments?.map(attachment => ( + + ))} +
+ )}