Skip to content

Commit

Permalink
fixed namings (#510)
Browse files Browse the repository at this point in the history
fixed message send issue using send-btn
  • Loading branch information
Spiral-Memory authored Mar 12, 2024
1 parent 5fa3ed1 commit b6fe5d1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/react/src/components/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const ChatInput = ({ scrollToBottom }) => {
(state) => state.setIsLoginModalOpen
);

const [msgLongMsgLongErrorModal, setMsgLongErrorModal] = useState(false);
const [isMsgLong, setIsMsgLong] = useState(false);

const {
editMessage,
Expand Down Expand Up @@ -129,11 +129,11 @@ const ChatInput = ({ scrollToBottom }) => {
const openLoginModal = () => {
setIsLoginModalOpen(true);
};
const openMsgLongErrorModal = () => {
setMsgLongErrorModal(true);
const openMsgLongModal = () => {
setIsMsgLong(true);
};
const closeMsgLongErrorModal = () => {
setMsgLongErrorModal(false);
const closeMsgLongModal = () => {
setIsMsgLong(false);
};

const onJoin = async () => {
Expand Down Expand Up @@ -176,7 +176,7 @@ const ChatInput = ({ scrollToBottom }) => {

const msgMaxLength = 500;
if (message.length > msgMaxLength) {
openMsgLongErrorModal();
openMsgLongModal();
return;
}

Expand Down Expand Up @@ -247,7 +247,7 @@ const ChatInput = ({ scrollToBottom }) => {
};

const handleConvertToAttachment = () => {
closeMsgLongErrorModal();
closeMsgLongModal();
sendMessage(true);
};

Expand Down Expand Up @@ -548,7 +548,7 @@ const ChatInput = ({ scrollToBottom }) => {
<ActionButton
ghost
size="medium"
onClick={sendMessage}
onClick={() => sendMessage()}
disabled={disableButton || isRecordingMessage}
>
<Icon className={styles.chatInputIconCursor} name="send" />
Expand All @@ -567,20 +567,20 @@ const ChatInput = ({ scrollToBottom }) => {
/>
)}
</Box>
{msgLongMsgLongErrorModal && (
{isMsgLong && (
<Modal>
<Modal
css={css`
padding: 1em;
`}
onClose={closeMsgLongErrorModal}
onClose={closeMsgLongModal}
>
<Modal.Header>
<Modal.Title>
<Icon name="report" size="1.25rem" />
Message Too Long!
</Modal.Title>
<Modal.Close onClick={closeMsgLongErrorModal} />
<Modal.Close onClick={closeMsgLongModal} />
</Modal.Header>
<Modal.Content
css={css`
Expand All @@ -591,7 +591,7 @@ const ChatInput = ({ scrollToBottom }) => {
Send it as attachment instead?{' '}
</Modal.Content>
<Modal.Footer>
<Button color="secondary" onClick={closeMsgLongErrorModal}>
<Button color="secondary" onClick={closeMsgLongModal}>
Cancel
</Button>
<Button onClick={handleConvertToAttachment} color="primary">
Expand Down

0 comments on commit b6fe5d1

Please sign in to comment.