2017-05-02 17:04:16 -07:00
|
|
|
import React from 'react';
|
2017-01-30 12:40:55 -08:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2017-04-21 11:05:35 -07:00
|
|
|
import PropTypes from 'prop-types';
|
2017-01-30 12:40:55 -08:00
|
|
|
import InnerHeader from '../../account/components/header';
|
|
|
|
import ActionBar from '../../account/components/action_bar';
|
2017-02-26 14:06:27 -08:00
|
|
|
import MissingIndicator from '../../../components/missing_indicator';
|
2017-05-02 17:04:16 -07:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-02 17:04:16 -07:00
|
|
|
class Header extends ImmutablePureComponent {
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
|
me: PropTypes.number.isRequired,
|
|
|
|
onFollow: PropTypes.func.isRequired,
|
|
|
|
onBlock: PropTypes.func.isRequired,
|
|
|
|
onMention: PropTypes.func.isRequired,
|
|
|
|
onReport: PropTypes.func.isRequired,
|
|
|
|
onMute: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
router: PropTypes.object
|
|
|
|
};
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
handleFollow = () => {
|
2017-01-30 12:40:55 -08:00
|
|
|
this.props.onFollow(this.props.account);
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
handleBlock = () => {
|
2017-01-30 12:40:55 -08:00
|
|
|
this.props.onBlock(this.props.account);
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
handleMention = () => {
|
2017-01-30 12:40:55 -08:00
|
|
|
this.props.onMention(this.props.account, this.context.router);
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2017-01-30 12:40:55 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
handleReport = () => {
|
2017-02-14 11:59:26 -08:00
|
|
|
this.props.onReport(this.props.account);
|
|
|
|
this.context.router.push('/report');
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2017-02-14 11:59:26 -08:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
handleMute = () => {
|
2017-02-05 17:51:56 -08:00
|
|
|
this.props.onMute(this.props.account);
|
2017-04-21 11:05:35 -07:00
|
|
|
}
|
2017-02-05 17:51:56 -08:00
|
|
|
|
2017-01-30 12:40:55 -08:00
|
|
|
render () {
|
|
|
|
const { account, me } = this.props;
|
|
|
|
|
2017-02-26 14:06:27 -08:00
|
|
|
if (account === null) {
|
|
|
|
return <MissingIndicator />;
|
2017-01-30 12:40:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2017-04-22 19:26:55 -07:00
|
|
|
<div className='account-timeline__header'>
|
2017-01-30 12:40:55 -08:00
|
|
|
<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-02-05 17:51:56 -08:00
|
|
|
onMute={this.handleMute}
|
2017-01-30 12:40:55 -08:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-04-21 11:05:35 -07:00
|
|
|
|
2017-05-12 05:44:10 -07:00
|
|
|
}
|
2017-01-30 12:40:55 -08:00
|
|
|
|
|
|
|
export default Header;
|