import { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages, FormattedMessage } from 'react-intl'; import Button from 'flavours/glitch/components/button'; import Toggle from 'react-toggle'; const messages = defineMessages({ placeholder: { id: 'report.placeholder', defaultMessage: 'Type or paste additional comments' }, }); class Comment extends PureComponent { static propTypes = { onSubmit: PropTypes.func.isRequired, comment: PropTypes.string.isRequired, onChangeComment: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, isSubmitting: PropTypes.bool, forward: PropTypes.bool, isRemote: PropTypes.bool, domain: PropTypes.string, onChangeForward: PropTypes.func.isRequired, }; handleClick = () => { const { onSubmit } = this.props; onSubmit(); }; handleChange = e => { const { onChangeComment } = this.props; onChangeComment(e.target.value); }; handleKeyDown = e => { if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) { this.handleClick(); } }; handleForwardChange = e => { const { onChangeForward } = this.props; onChangeForward(e.target.checked); }; render () { const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props; return ( <>