Skip to content

Commit

Permalink
Merge pull request #678 from Thenujan-Nagaratnam/marketplace-assistan…
Browse files Browse the repository at this point in the history
…t-ai

disable send option while loading
  • Loading branch information
Arshardh authored Apr 3, 2024
2 parents f57479c + 55396c6 commit 63f474e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import InputAdornment from '@mui/material/InputAdornment';
* @returns {JSX} renders Chat Input view.
*/
function ChatInput(props) {
const { onSend } = props;
const { onSend, loading } = props;
const [content, setContent] = useState('');
const [notificationOpen, setNotificationOpen] = useState(false);
const QUERY_CHARACTER_LIMIT = 500;
Expand All @@ -57,7 +57,9 @@ function ChatInput(props) {
const handleKeyDown = (e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleSend();
if (!loading) {
handleSend();
}
}
if (e.keyCode === 13 && e.shiftKey) {
e.preventDefault();
Expand Down Expand Up @@ -90,6 +92,7 @@ function ChatInput(props) {
<IconButton
aria-label='marketplace-chat-message'
onClick={handleSend}
disabled={loading}
>
<SendIcon color='primary' />
</IconButton>
Expand Down Expand Up @@ -124,5 +127,6 @@ function ChatInput(props) {

ChatInput.propTypes = {
onSend: PropTypes.func.isRequired,
loading: PropTypes.bool.isRequired,
};
export default ChatInput;
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function ChatMessages(props) {
maxWidth='1380px'
marginRight='5%'
>
<ChatInput onSend={onSend} />
<ChatInput onSend={onSend} loading={loading} />
</Box>

</Box>
Expand Down

0 comments on commit 63f474e

Please sign in to comment.