about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/report/index.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/components/features/report/index.jsx')
-rw-r--r--app/assets/javascripts/components/features/report/index.jsx48
1 files changed, 26 insertions, 22 deletions
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));