2017-01-30 12:40:55 -08:00
|
|
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import InnerHeader from '../../account/components/header';
|
|
|
|
import ActionBar from '../../account/components/action_bar';
|
|
|
|
|
|
|
|
const Header = React.createClass({
|
|
|
|
contextTypes: {
|
|
|
|
router: React.PropTypes.object
|
|
|
|
},
|
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
me: React.PropTypes.number.isRequired,
|
|
|
|
onFollow: React.PropTypes.func.isRequired,
|
|
|
|
onBlock: React.PropTypes.func.isRequired,
|
2017-02-14 11:59:26 -08:00
|
|
|
onMention: React.PropTypes.func.isRequired,
|
|
|
|
onReport: React.PropTypes.func.isRequired
|
2017-01-30 12:40:55 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
mixins: [PureRenderMixin],
|
|
|
|
|
|
|
|
handleFollow () {
|
|
|
|
this.props.onFollow(this.props.account);
|
|
|
|
},
|
|
|
|
|
|
|
|
handleBlock () {
|
|
|
|
this.props.onBlock(this.props.account);
|
|
|
|
},
|
|
|
|
|
|
|
|
handleMention () {
|
|
|
|
this.props.onMention(this.props.account, this.context.router);
|
|
|
|
},
|
|
|
|
|
2017-02-14 11:59:26 -08:00
|
|
|
handleReport () {
|
|
|
|
this.props.onReport(this.props.account);
|
|
|
|
this.context.router.push('/report');
|
|
|
|
},
|
|
|
|
|
2017-01-30 12:40:55 -08:00
|
|
|
render () {
|
|
|
|
const { account, me } = this.props;
|
|
|
|
|
|
|
|
if (!account) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<InnerHeader
|
|
|
|
account={account}
|
|
|
|
me={me}
|
|
|
|
onFollow={this.handleFollow}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<ActionBar
|
|
|
|
account={account}
|
|
|
|
me={me}
|
|
|
|
onBlock={this.handleBlock}
|
|
|
|
onMention={this.handleMention}
|
2017-02-14 11:59:26 -08:00
|
|
|
onReport={this.handleReport}
|
2017-01-30 12:40:55 -08:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Header;
|