diff options
Diffstat (limited to 'app/assets/javascripts/components/components/status_action_bar.jsx')
-rw-r--r-- | app/assets/javascripts/components/components/status_action_bar.jsx | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/app/assets/javascripts/components/components/status_action_bar.jsx b/app/assets/javascripts/components/components/status_action_bar.jsx index 213aa7743..b452cb8cf 100644 --- a/app/assets/javascripts/components/components/status_action_bar.jsx +++ b/app/assets/javascripts/components/components/status_action_bar.jsx @@ -1,5 +1,5 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; -import PureRenderMixin from 'react-addons-pure-render-mixin'; +import PropTypes from 'prop-types'; import IconButton from './icon_button'; import DropdownMenu from './dropdown_menu'; import { defineMessages, injectIntl } from 'react-intl'; @@ -17,64 +17,57 @@ const messages = defineMessages({ report: { id: 'status.report', defaultMessage: 'Report @{name}' } }); -const StatusActionBar = React.createClass({ - - contextTypes: { - router: React.PropTypes.object - }, - - propTypes: { - status: ImmutablePropTypes.map.isRequired, - onReply: React.PropTypes.func, - onFavourite: React.PropTypes.func, - onReblog: React.PropTypes.func, - onDelete: React.PropTypes.func, - onMention: React.PropTypes.func, - onMute: React.PropTypes.func, - onBlock: React.PropTypes.func, - onReport: React.PropTypes.func, - me: React.PropTypes.number.isRequired, - intl: React.PropTypes.object.isRequired - }, - - mixins: [PureRenderMixin], +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); + } handleReplyClick () { this.props.onReply(this.props.status, this.context.router); - }, + } handleFavouriteClick () { this.props.onFavourite(this.props.status); - }, + } handleReblogClick (e) { this.props.onReblog(this.props.status, e); - }, + } handleDeleteClick () { this.props.onDelete(this.props.status); - }, + } handleMentionClick () { this.props.onMention(this.props.status.get('account'), this.context.router); - }, + } handleMuteClick () { this.props.onMute(this.props.status.get('account')); - }, + } handleBlockClick () { this.props.onBlock(this.props.status.get('account')); - }, + } handleOpen () { this.context.router.push(`/statuses/${this.props.status.get('id')}`); - }, + } handleReport () { this.props.onReport(this.props.status); this.context.router.push('/report'); - }, + } render () { const { status, me, intl } = this.props; @@ -119,6 +112,24 @@ const StatusActionBar = React.createClass({ ); } -}); +} + +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); |