2017-01-30 21:40:55 +01: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';
|
2017-02-26 23:06:27 +01:00
|
|
|
import MissingIndicator from '../../../components/missing_indicator';
|
2017-01-30 21:40:55 +01:00
|
|
|
|
|
|
|
const Header = React.createClass({
|
|
|
|
contextTypes: {
|
|
|
|
router: React.PropTypes.object
|
|
|
|
},
|
|
|
|
|
|
|
|
propTypes: {
|
2017-02-26 23:06:27 +01:00
|
|
|
account: ImmutablePropTypes.map,
|
2017-01-30 21:40:55 +01:00
|
|
|
me: React.PropTypes.number.isRequired,
|
|
|
|
onFollow: React.PropTypes.func.isRequired,
|
|
|
|
onBlock: React.PropTypes.func.isRequired,
|
2017-02-14 20:59:26 +01:00
|
|
|
onMention: React.PropTypes.func.isRequired,
|
2017-03-02 18:49:32 +01:00
|
|
|
onReport: React.PropTypes.func.isRequired,
|
|
|
|
onMute: React.PropTypes.func.isRequired
|
2017-01-30 21:40:55 +01: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 20:59:26 +01:00
|
|
|
handleReport () {
|
|
|
|
this.props.onReport(this.props.account);
|
|
|
|
this.context.router.push('/report');
|
|
|
|
},
|
|
|
|
|
2017-02-06 02:51:56 +01:00
|
|
|
handleMute() {
|
|
|
|
this.props.onMute(this.props.account);
|
|
|
|
},
|
|
|
|
|
2017-01-30 21:40:55 +01:00
|
|
|
render () {
|
|
|
|
const { account, me } = this.props;
|
|
|
|
|
2017-02-26 23:06:27 +01:00
|
|
|
if (account === null) {
|
|
|
|
return <MissingIndicator />;
|
2017-01-30 21:40:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<InnerHeader
|
|
|
|
account={account}
|
|
|
|
me={me}
|
|
|
|
onFollow={this.handleFollow}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<ActionBar
|
|
|
|
account={account}
|
|
|
|
me={me}
|
|
|
|
onBlock={this.handleBlock}
|
|
|
|
onMention={this.handleMention}
|
2017-02-14 20:59:26 +01:00
|
|
|
onReport={this.handleReport}
|
2017-02-06 02:51:56 +01:00
|
|
|
onMute={this.handleMute}
|
2017-01-30 21:40:55 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Header;
|