diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2017-04-22 03:05:35 +0900 |
---|---|---|
committer | Eugen <eugen@zeonfederated.com> | 2017-04-21 20:05:35 +0200 |
commit | 1948f9e767c5c8f7cb52337ce777a61b5ad1a599 (patch) | |
tree | 4d5f3549f6e5fd88340bb3543e1eb2eafc47952c /app/assets/javascripts/components/features/report | |
parent | 27ea2a88c12835b491ea5537f934983470faf781 (diff) |
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 59a77923b368d48c590cd9f4a0c6b73ce972d33f
Diffstat (limited to 'app/assets/javascripts/components/features/report')
-rw-r--r-- | app/assets/javascripts/components/features/report/components/status_check_box.jsx | 22 | ||||
-rw-r--r-- | app/assets/javascripts/components/features/report/index.jsx | 48 |
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)); |