Remove deprecated features at React v15.5 (#1905)
* Remove deprecated features at React v15.5
- [x] React.PropTypes
- [x] react-addons-pure-render-mixin
- [x] react-addons-test-utils
* Uncommented out & Add browserify_rails options
* re-add react-addons-shallow
* Fix syntax error from resolve conflicts
* follow up 59a77923b3
This commit is contained in:
committed by
Eugen
parent
27ea2a88c1
commit
1948f9e767
@ -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));
|
||||
|
Reference in New Issue
Block a user