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
				
			
		|  | @ -56,18 +56,21 @@ const makeMapStateToProps = () => { | |||
| 
 | ||||
| class Status extends ImmutablePureComponent { | ||||
| 
 | ||||
|   constructor (props, context) { | ||||
|     super(props, context); | ||||
|     this.handleFavouriteClick = this.handleFavouriteClick.bind(this); | ||||
|     this.handleReplyClick = this.handleReplyClick.bind(this); | ||||
|     this.handleModalReblog = this.handleModalReblog.bind(this); | ||||
|     this.handleReblogClick = this.handleReblogClick.bind(this); | ||||
|     this.handleDeleteClick = this.handleDeleteClick.bind(this); | ||||
|     this.handleMentionClick = this.handleMentionClick.bind(this); | ||||
|     this.handleOpenMedia = this.handleOpenMedia.bind(this); | ||||
|     this.handleOpenVideo = this.handleOpenVideo.bind(this); | ||||
|     this.handleReport = this.handleReport.bind(this); | ||||
|   } | ||||
|   static contextTypes = { | ||||
|     router: PropTypes.object | ||||
|   }; | ||||
| 
 | ||||
|   static propTypes = { | ||||
|     params: PropTypes.object.isRequired, | ||||
|     dispatch: PropTypes.func.isRequired, | ||||
|     status: ImmutablePropTypes.map, | ||||
|     ancestorsIds: ImmutablePropTypes.list, | ||||
|     descendantsIds: ImmutablePropTypes.list, | ||||
|     me: PropTypes.number, | ||||
|     boostModal: PropTypes.bool, | ||||
|     autoPlayGif: PropTypes.bool, | ||||
|     intl: PropTypes.object.isRequired | ||||
|   }; | ||||
| 
 | ||||
|   componentWillMount () { | ||||
|     this.props.dispatch(fetchStatus(Number(this.props.params.statusId))); | ||||
|  | @ -79,7 +82,7 @@ class Status extends ImmutablePureComponent { | |||
|     } | ||||
|   } | ||||
| 
 | ||||
|   handleFavouriteClick (status) { | ||||
|   handleFavouriteClick = (status) => { | ||||
|     if (status.get('favourited')) { | ||||
|       this.props.dispatch(unfavourite(status)); | ||||
|     } else { | ||||
|  | @ -87,15 +90,15 @@ class Status extends ImmutablePureComponent { | |||
|     } | ||||
|   } | ||||
| 
 | ||||
|   handleReplyClick (status) { | ||||
|   handleReplyClick = (status) => { | ||||
|     this.props.dispatch(replyCompose(status, this.context.router)); | ||||
|   } | ||||
| 
 | ||||
|   handleModalReblog (status) { | ||||
|   handleModalReblog = (status) => { | ||||
|     this.props.dispatch(reblog(status)); | ||||
|   } | ||||
| 
 | ||||
|   handleReblogClick (status, e) { | ||||
|   handleReblogClick = (status, e) => { | ||||
|     if (status.get('reblogged')) { | ||||
|       this.props.dispatch(unreblog(status)); | ||||
|     } else { | ||||
|  | @ -107,7 +110,7 @@ class Status extends ImmutablePureComponent { | |||
|     } | ||||
|   } | ||||
| 
 | ||||
|   handleDeleteClick (status) { | ||||
|   handleDeleteClick = (status) => { | ||||
|     const { dispatch, intl } = this.props; | ||||
| 
 | ||||
|     dispatch(openModal('CONFIRM', { | ||||
|  | @ -117,19 +120,19 @@ class Status extends ImmutablePureComponent { | |||
|     })); | ||||
|   } | ||||
| 
 | ||||
|   handleMentionClick (account, router) { | ||||
|   handleMentionClick = (account, router) => { | ||||
|     this.props.dispatch(mentionCompose(account, router)); | ||||
|   } | ||||
| 
 | ||||
|   handleOpenMedia (media, index) { | ||||
|   handleOpenMedia = (media, index) => { | ||||
|     this.props.dispatch(openModal('MEDIA', { media, index })); | ||||
|   } | ||||
| 
 | ||||
|   handleOpenVideo (media, time) { | ||||
|   handleOpenVideo = (media, time) => { | ||||
|     this.props.dispatch(openModal('VIDEO', { media, time })); | ||||
|   } | ||||
| 
 | ||||
|   handleReport (status) { | ||||
|   handleReport = (status) => { | ||||
|     this.props.dispatch(initReport(status.get('account'), status)); | ||||
|   } | ||||
| 
 | ||||
|  | @ -180,20 +183,4 @@ class Status extends ImmutablePureComponent { | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| Status.contextTypes = { | ||||
|   router: PropTypes.object | ||||
| }; | ||||
| 
 | ||||
| Status.propTypes = { | ||||
|   params: PropTypes.object.isRequired, | ||||
|   dispatch: PropTypes.func.isRequired, | ||||
|   status: ImmutablePropTypes.map, | ||||
|   ancestorsIds: ImmutablePropTypes.list, | ||||
|   descendantsIds: ImmutablePropTypes.list, | ||||
|   me: PropTypes.number, | ||||
|   boostModal: PropTypes.bool, | ||||
|   autoPlayGif: PropTypes.bool, | ||||
|   intl: PropTypes.object.isRequired | ||||
| }; | ||||
| 
 | ||||
| export default injectIntl(connect(makeMapStateToProps)(Status)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue