Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/fro preview multiple #2799

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/ui/src/message-pane-input/components/ToolbarBottom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const ToolbarBottom = props => {
} = props;
const [focus, setFocus] = useState(false);
const toggleFocus = () => setFocus(!false);
const [attachedFile, setAttachedFile] = useState(null);
const [attachedFile, setAttachedFile] = useState([]);
const [inputKey, setInputKey] = useState("any-key-press");
const [showAttachInputBox, setshowAttachInputBox] = useState(false);
//const [preview, setPreview] = useState('')
Expand All @@ -81,13 +81,12 @@ const ToolbarBottom = props => {
//Handles sending of attachedfile
const handleAttachMedia = e => {
{
e.preventDefault();
// e.preventDefault();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

//Post request is sent here
sendMessageHandler(attachedFile);

sendAttachedFileHandler(attachedFile);
//Then this is to clear the file from the state
props.sentAttachedFile(null);
clearAttached();
// props.sentAttachedFile(null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments

// clearAttached();
}
};

Expand All @@ -96,9 +95,10 @@ const ToolbarBottom = props => {
};

const handleSelectMedia = e => {
setAttachedFile(e.target.files);
props.sentAttachedFile(e.target.files);
setAttachedFile([e.target.files[0], ...attachedFile]);
props.sentAttachedFile([e.target.files[0], ...attachedFile]);
setshowAttachInputBox(false);
handleAttachMedia();
};

// on click clear attached file
Expand Down Expand Up @@ -222,7 +222,7 @@ const ToolbarBottom = props => {
</span>
</FormatContainer>
<SendContainer>
<UnstyledButton onClick={handleClickSendMessage || handleAttachMedia}>
<UnstyledButton onClick={handleClickSendMessage}>
<SendIcon />
</UnstyledButton>
</SendContainer>
Expand Down