diff --git a/app/soapbox/features/chats/components/chat-composer.tsx b/app/soapbox/features/chats/components/chat-composer.tsx index f2c40ca14..7ffc48146 100644 --- a/app/soapbox/features/chats/components/chat-composer.tsx +++ b/app/soapbox/features/chats/components/chat-composer.tsx @@ -44,6 +44,8 @@ interface IChatComposer extends Pick void + isUploading?: boolean + uploadProgress?: number } /** Textarea input for chats. */ @@ -59,6 +61,8 @@ const ChatComposer = React.forwardRef onPaste, attachments = [], onDeleteAttachment, + isUploading, + uploadProgress, }, ref) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -189,6 +193,8 @@ const ChatComposer = React.forwardRef disabled={disabled} attachments={attachments} onDeleteAttachment={onDeleteAttachment} + isUploading={isUploading} + uploadProgress={uploadProgress} /> {isSuggestionsAvailable ? ( diff --git a/app/soapbox/features/chats/components/chat-textarea.tsx b/app/soapbox/features/chats/components/chat-textarea.tsx index e11aeecbc..18950300f 100644 --- a/app/soapbox/features/chats/components/chat-textarea.tsx +++ b/app/soapbox/features/chats/components/chat-textarea.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Textarea } from 'soapbox/components/ui'; +import { ProgressBar, Textarea } from 'soapbox/components/ui'; import { Attachment } from 'soapbox/types/entities'; import ChatUpload from './chat-upload'; @@ -8,10 +8,18 @@ import ChatUpload from './chat-upload'; interface IChatTextarea extends React.ComponentProps { attachments?: Attachment[] onDeleteAttachment?: () => void + isUploading?: boolean + uploadProgress?: number } /** Custom textarea for chats. */ -const ChatTextarea: React.FC = ({ attachments, onDeleteAttachment, ...rest }) => { +const ChatTextarea: React.FC = ({ + attachments, + onDeleteAttachment, + isUploading = false, + uploadProgress = 0, + ...rest +}) => { return (
= ({ attachments, onDeleteAttachment dark:focus-within:ring-primary-500 dark:focus-within:border-primary-500 `} > - {(!!attachments?.length) && ( + {(!!attachments?.length || isUploading) && (
+ {isUploading && ( +
+ +
+ )} + {attachments?.map(attachment => ( = ({ chat, inputRef, className }) => {
- {isUploading && ( -
- -
- )} - = ({ chat, inputRef, className }) => { onPaste={handlePaste} attachments={attachment ? [attachment] : []} onDeleteAttachment={handleRemoveFile} + isUploading={isUploading} + uploadProgress={uploadProgress} /> );