0
0
Fork 0

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:
Yamagishi Kazutoshi 2017-05-12 21:44:10 +09:00 committed by Eugen Rochko
parent 44a3584e2d
commit 2991a7cfe6
79 changed files with 838 additions and 1128 deletions

View file

@ -21,52 +21,57 @@ const messages = defineMessages({
class StatusActionBar extends React.PureComponent {
constructor (props, context) {
super(props, context);
this.handleReplyClick = this.handleReplyClick.bind(this);
this.handleFavouriteClick = this.handleFavouriteClick.bind(this);
this.handleReblogClick = this.handleReblogClick.bind(this);
this.handleDeleteClick = this.handleDeleteClick.bind(this);
this.handleMentionClick = this.handleMentionClick.bind(this);
this.handleMuteClick = this.handleMuteClick.bind(this);
this.handleBlockClick = this.handleBlockClick.bind(this);
this.handleOpen = this.handleOpen.bind(this);
this.handleReport = this.handleReport.bind(this);
}
static contextTypes = {
router: PropTypes.object
};
handleReplyClick () {
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
onReply: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
onMention: PropTypes.func,
onMute: PropTypes.func,
onBlock: PropTypes.func,
onReport: PropTypes.func,
me: PropTypes.number.isRequired,
intl: PropTypes.object.isRequired
};
handleReplyClick = () => {
this.props.onReply(this.props.status, this.context.router);
}
handleFavouriteClick () {
handleFavouriteClick = () => {
this.props.onFavourite(this.props.status);
}
handleReblogClick (e) {
handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
handleDeleteClick () {
handleDeleteClick = () => {
this.props.onDelete(this.props.status);
}
handleMentionClick () {
handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router);
}
handleMuteClick () {
handleMuteClick = () => {
this.props.onMute(this.props.status.get('account'));
}
handleBlockClick () {
handleBlockClick = () => {
this.props.onBlock(this.props.status.get('account'));
}
handleOpen () {
handleOpen = () => {
this.context.router.push(`/statuses/${this.props.status.get('id')}`);
}
handleReport () {
handleReport = () => {
this.props.onReport(this.props.status);
this.context.router.push('/report');
}
@ -122,22 +127,4 @@ class StatusActionBar extends React.PureComponent {
}
StatusActionBar.contextTypes = {
router: PropTypes.object
};
StatusActionBar.propTypes = {
status: ImmutablePropTypes.map.isRequired,
onReply: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onDelete: PropTypes.func,
onMention: PropTypes.func,
onMute: PropTypes.func,
onBlock: PropTypes.func,
onReport: PropTypes.func,
me: PropTypes.number.isRequired,
intl: PropTypes.object.isRequired
};
export default injectIntl(StatusActionBar);