|
|
|
@ -8,7 +8,7 @@ import ChatUpload from './chat-upload';
|
|
|
|
|
|
|
|
|
|
interface IChatTextarea extends React.ComponentProps<typeof Textarea> {
|
|
|
|
|
attachments?: Attachment[]
|
|
|
|
|
onDeleteAttachment?: () => void
|
|
|
|
|
onDeleteAttachment?: (i: number) => void
|
|
|
|
|
isUploading?: boolean
|
|
|
|
|
uploadProgress?: number
|
|
|
|
|
}
|
|
|
|
@ -21,6 +21,14 @@ const ChatTextarea: React.FC<IChatTextarea> = ({
|
|
|
|
|
uploadProgress = 0,
|
|
|
|
|
...rest
|
|
|
|
|
}) => {
|
|
|
|
|
const handleDeleteAttachment = (i: number) => {
|
|
|
|
|
return () => {
|
|
|
|
|
if (onDeleteAttachment) {
|
|
|
|
|
onDeleteAttachment(i);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`
|
|
|
|
|
block
|
|
|
|
@ -36,12 +44,12 @@ const ChatTextarea: React.FC<IChatTextarea> = ({
|
|
|
|
|
>
|
|
|
|
|
{(!!attachments?.length || isUploading) && (
|
|
|
|
|
<HStack className='-ml-2 -mt-2 p-3 pb-0' wrap>
|
|
|
|
|
{attachments?.map(attachment => (
|
|
|
|
|
{attachments?.map((attachment, i) => (
|
|
|
|
|
<div className='ml-2 mt-2 flex'>
|
|
|
|
|
<ChatUpload
|
|
|
|
|
key={attachment.id}
|
|
|
|
|
attachment={attachment}
|
|
|
|
|
onDelete={onDeleteAttachment}
|
|
|
|
|
onDelete={handleDeleteAttachment(i)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|