diff --git a/packages/react/src/hooks/useDropBox.js b/packages/react/src/hooks/useDropBox.js index a78b39509..ca2c5149c 100644 --- a/packages/react/src/hooks/useDropBox.js +++ b/packages/react/src/hooks/useDropBox.js @@ -12,12 +12,12 @@ const useDropBox = () => { const handleDragDrop = (e) => { e.preventDefault(); toggle(); - setData(e.dataTransfer.files[0]); + setData([...e.dataTransfer.files]); }; const handlePaste = (file) => { toggle(); - setData(file); + setData([file]); }; return { diff --git a/packages/react/src/store/attachmentwindow.js b/packages/react/src/store/attachmentwindow.js index 568c37ae5..034089dce 100644 --- a/packages/react/src/store/attachmentwindow.js +++ b/packages/react/src/store/attachmentwindow.js @@ -2,7 +2,7 @@ import { create } from 'zustand'; const useAttachmentWindowStore = create((set) => ({ attachmentWindowOpen: false, - data: null, + data: [], toggle: () => set((state) => ({ attachmentWindowOpen: !state.attachmentWindowOpen })), setData: (file) => { diff --git a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js index e6dadeae6..e71207d7a 100644 --- a/packages/react/src/views/AttachmentPreview/AttachmentPreview.js +++ b/packages/react/src/views/AttachmentPreview/AttachmentPreview.js @@ -74,14 +74,18 @@ const AttachmentPreview = () => { setIsPending(true); try { - await RCInstance.sendAttachment( - data, - fileName, - parseEmoji(description), - ECOptions?.enableThreads ? threadId : undefined - ); + await Promise.all( + data.map((file) => + RCInstance.sendAttachment( + file, + file.name, + parseEmoji(description), + ECOptions?.enableThreads ? threadId : undefined + ) + ) + ) toggle(); - setData(null); + setData([]); } finally { setIsPending(false); } @@ -112,40 +116,46 @@ const AttachmentPreview = () => { - - - + {/* 1. THE PARENT ROW: Only handles horizontal scrolling and spacing */} - + {data.map((file, index) => ( + /* 2. THE LOCAL WRAPPER: Enforces the 200px height limit on each individual item */ div { + height: 100% !important; + width: auto !important; + max-width: none !important; + object-fit: contain !important; + } `} > - File name + - - - + ))} + + {/* 3. THE RESTORED DESCRIPTION INPUT */} + { value={description} css={css` ${styles.input}; - border-color: ${isOverLimit - ? theme.colors.destructive - : null}; + border-color: ${isOverLimit ? theme.colors.destructive : null}; color: ${isOverLimit ? theme.colors.destructive : null}; `} /> @@ -202,9 +210,7 @@ const AttachmentPreview = () => { > { aria-hidden={!isOverLimit} role={isOverLimit ? 'alert' : undefined} > - {isOverLimit - ? `Cannot upload file, description is over the ${msgMaxLength} character limit` - : ''} + {isOverLimit ? `Cannot upload file, description is over the ${msgMaxLength} character limit` : ''} { +