Use ES Class Fields & Static Properties (#3008)
Use ES Class Fields & Static Properties (currently stage 2) for improve class outlook. Added babel-plugin-transform-class-properties as a Babel plugin.
This commit is contained in:
parent
44a3584e2d
commit
2991a7cfe6
79 changed files with 838 additions and 1128 deletions
|
@ -6,6 +6,13 @@ import Toggle from 'react-toggle';
|
|||
|
||||
class StatusCheckBox extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
status: ImmutablePropTypes.map.isRequired,
|
||||
checked: PropTypes.bool,
|
||||
onToggle: PropTypes.func.isRequired,
|
||||
disabled: PropTypes.bool
|
||||
};
|
||||
|
||||
render () {
|
||||
const { status, checked, onToggle, disabled } = this.props;
|
||||
const content = { __html: emojify(status.get('content')) };
|
||||
|
@ -30,11 +37,4 @@ class StatusCheckBox extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
StatusCheckBox.propTypes = {
|
||||
status: ImmutablePropTypes.map.isRequired,
|
||||
checked: PropTypes.bool,
|
||||
onToggle: PropTypes.func.isRequired,
|
||||
disabled: PropTypes.bool
|
||||
};
|
||||
|
||||
export default StatusCheckBox;
|
||||
|
|
|
@ -37,11 +37,18 @@ const makeMapStateToProps = () => {
|
|||
|
||||
class Report extends React.PureComponent {
|
||||
|
||||
constructor (props, context) {
|
||||
super(props, context);
|
||||
this.handleCommentChange = this.handleCommentChange.bind(this);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
static contextTypes = {
|
||||
router: PropTypes.object
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
isSubmitting: PropTypes.bool,
|
||||
account: ImmutablePropTypes.map,
|
||||
statusIds: ImmutablePropTypes.orderedSet.isRequired,
|
||||
comment: PropTypes.string.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
componentWillMount () {
|
||||
if (!this.props.account) {
|
||||
|
@ -63,11 +70,11 @@ class Report extends React.PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
handleCommentChange (e) {
|
||||
handleCommentChange = (e) => {
|
||||
this.props.dispatch(changeReportComment(e.target.value));
|
||||
}
|
||||
|
||||
handleSubmit () {
|
||||
handleSubmit = () => {
|
||||
this.props.dispatch(submitReport());
|
||||
this.context.router.replace('/');
|
||||
}
|
||||
|
@ -115,17 +122,4 @@ class Report extends React.PureComponent {
|
|||
|
||||
}
|
||||
|
||||
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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue