You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.5 KiB
96 lines
2.5 KiB
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||
8 years ago
|
import PropTypes from 'prop-types';
|
||
7 years ago
|
import InnerHeader from 'flavours/glitch/features/account/components/header';
|
||
|
import ActionBar from 'flavours/glitch/features/account/components/action_bar';
|
||
|
import MissingIndicator from 'flavours/glitch/components/missing_indicator';
|
||
8 years ago
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||
8 years ago
|
|
||
8 years ago
|
export default class Header extends ImmutablePureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
static propTypes = {
|
||
|
account: ImmutablePropTypes.map,
|
||
|
onFollow: PropTypes.func.isRequired,
|
||
|
onBlock: PropTypes.func.isRequired,
|
||
|
onMention: PropTypes.func.isRequired,
|
||
7 years ago
|
onReblogToggle: PropTypes.func.isRequired,
|
||
8 years ago
|
onReport: PropTypes.func.isRequired,
|
||
8 years ago
|
onMute: PropTypes.func.isRequired,
|
||
|
onBlockDomain: PropTypes.func.isRequired,
|
||
|
onUnblockDomain: PropTypes.func.isRequired,
|
||
8 years ago
|
};
|
||
|
|
||
|
static contextTypes = {
|
||
8 years ago
|
router: PropTypes.object,
|
||
8 years ago
|
};
|
||
8 years ago
|
|
||
8 years ago
|
handleFollow = () => {
|
||
8 years ago
|
this.props.onFollow(this.props.account);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
handleBlock = () => {
|
||
8 years ago
|
this.props.onBlock(this.props.account);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
handleMention = () => {
|
||
8 years ago
|
this.props.onMention(this.props.account, this.context.router.history);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
handleReport = () => {
|
||
8 years ago
|
this.props.onReport(this.props.account);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
7 years ago
|
handleReblogToggle = () => {
|
||
|
this.props.onReblogToggle(this.props.account);
|
||
|
}
|
||
|
|
||
8 years ago
|
handleMute = () => {
|
||
8 years ago
|
this.props.onMute(this.props.account);
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
handleBlockDomain = () => {
|
||
|
const domain = this.props.account.get('acct').split('@')[1];
|
||
|
|
||
|
if (!domain) return;
|
||
|
|
||
|
this.props.onBlockDomain(domain, this.props.account.get('id'));
|
||
|
}
|
||
|
|
||
|
handleUnblockDomain = () => {
|
||
|
const domain = this.props.account.get('acct').split('@')[1];
|
||
|
|
||
|
if (!domain) return;
|
||
|
|
||
|
this.props.onUnblockDomain(domain, this.props.account.get('id'));
|
||
|
}
|
||
|
|
||
8 years ago
|
render () {
|
||
7 years ago
|
const { account } = this.props;
|
||
8 years ago
|
|
||
8 years ago
|
if (account === null) {
|
||
|
return <MissingIndicator />;
|
||
8 years ago
|
}
|
||
|
|
||
|
return (
|
||
8 years ago
|
<div className='account-timeline__header'>
|
||
8 years ago
|
<InnerHeader
|
||
|
account={account}
|
||
|
onFollow={this.handleFollow}
|
||
|
/>
|
||
|
|
||
|
<ActionBar
|
||
|
account={account}
|
||
|
onBlock={this.handleBlock}
|
||
|
onMention={this.handleMention}
|
||
7 years ago
|
onReblogToggle={this.handleReblogToggle}
|
||
8 years ago
|
onReport={this.handleReport}
|
||
8 years ago
|
onMute={this.handleMute}
|
||
8 years ago
|
onBlockDomain={this.handleBlockDomain}
|
||
|
onUnblockDomain={this.handleUnblockDomain}
|
||
8 years ago
|
/>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
}
|