about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/report
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/features/report')
-rw-r--r--app/assets/javascripts/components/features/report/components/status_check_box.jsx22
-rw-r--r--app/assets/javascripts/components/features/report/index.jsx48
2 files changed, 36 insertions, 34 deletions
diff --git a/app/assets/javascripts/components/features/report/components/status_check_box.jsx b/app/assets/javascripts/components/features/report/components/status_check_box.jsx
index 6d976582b..4268e5f3d 100644
--- a/app/assets/javascripts/components/features/report/components/status_check_box.jsx
+++ b/app/assets/javascripts/components/features/report/components/status_check_box.jsx
@@ -1,18 +1,9 @@
-import PureRenderMixin from 'react-addons-pure-render-mixin';
+import PropTypes from 'prop-types';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import emojify from '../../../emoji';
 import Toggle from 'react-toggle';
 
-const StatusCheckBox = React.createClass({
-
-  propTypes: {
-    status: ImmutablePropTypes.map.isRequired,
-    checked: React.PropTypes.bool,
-    onToggle: React.PropTypes.func.isRequired,
-    disabled: React.PropTypes.bool
-  },
-
-  mixins: [PureRenderMixin],
+class StatusCheckBox extends React.PureComponent {
 
   render () {
     const { status, checked, onToggle, disabled } = this.props;
@@ -37,6 +28,13 @@ const StatusCheckBox = React.createClass({
     );
   }
 
-});
+}
+
+StatusCheckBox.propTypes = {
+  status: ImmutablePropTypes.map.isRequired,
+  checked: PropTypes.bool,
+  onToggle: PropTypes.func.isRequired,
+  disabled: PropTypes.bool
+};
 
 export default StatusCheckBox;
diff --git a/app/assets/javascripts/components/features/report/index.jsx b/app/assets/javascripts/components/features/report/index.jsx
index fc8e543c5..7b9b202a8 100644
--- a/app/assets/javascripts/components/features/report/index.jsx
+++ b/app/assets/javascripts/components/features/report/index.jsx
@@ -1,7 +1,7 @@
 import { connect } from 'react-redux';
 import { cancelReport, changeReportComment, submitReport } from '../../actions/reports';
 import { fetchAccountTimeline } from '../../actions/accounts';
-import PureRenderMixin from 'react-addons-pure-render-mixin';
+import PropTypes from 'prop-types';
 import ImmutablePropTypes from 'react-immutable-proptypes';
 import Column from '../ui/components/column';
 import Button from '../../components/button';
@@ -38,28 +38,19 @@ const textareaStyle = {
   marginBottom: '10px'
 };
 
-const Report = React.createClass({
+class Report extends React.PureComponent {
 
-  contextTypes: {
-    router: React.PropTypes.object
-  },
-
-  propTypes: {
-    isSubmitting: React.PropTypes.bool,
-    account: ImmutablePropTypes.map,
-    statusIds: ImmutablePropTypes.orderedSet.isRequired,
-    comment: React.PropTypes.string.isRequired,
-    dispatch: React.PropTypes.func.isRequired,
-    intl: React.PropTypes.object.isRequired
-  },
-
-  mixins: [PureRenderMixin],
+  constructor (props, context) {
+    super(props, context);
+    this.handleCommentChange = this.handleCommentChange.bind(this);
+    this.handleSubmit = this.handleSubmit.bind(this);
+  }
 
   componentWillMount () {
     if (!this.props.account) {
       this.context.router.replace('/');
     }
-  },
+  }
 
   componentDidMount () {
     if (!this.props.account) {
@@ -67,22 +58,22 @@ const Report = React.createClass({
     }
 
     this.props.dispatch(fetchAccountTimeline(this.props.account.get('id')));
-  },
+  }
 
   componentWillReceiveProps (nextProps) {
     if (this.props.account !== nextProps.account && nextProps.account) {
       this.props.dispatch(fetchAccountTimeline(nextProps.account.get('id')));
     }
-  },
+  }
 
   handleCommentChange (e) {
     this.props.dispatch(changeReportComment(e.target.value));
-  },
+  }
 
   handleSubmit () {
     this.props.dispatch(submitReport());
     this.context.router.replace('/');
-  },
+  }
 
   render () {
     const { account, comment, intl, statusIds, isSubmitting } = this.props;
@@ -126,6 +117,19 @@ const Report = React.createClass({
     );
   }
 
-});
+}
+
+Report.contextTypes = {
+  router: PropTypes.object
+};
+
+Report.propTypes = {
+  isSubmitting: PropTypes.bool,
+  account: ImmutablePropTypes.map,
+  statusIds: ImmutablePropTypes.orderedSet.isRequired,
+  comment: PropTypes.string.isRequired,
+  dispatch: PropTypes.func.isRequired,
+  intl: PropTypes.object.isRequired
+};
 
 export default connect(makeMapStateToProps)(injectIntl(Report));