The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

67 lines
1.5 KiB

  1. import PureRenderMixin from 'react-addons-pure-render-mixin';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import InnerHeader from '../../account/components/header';
  4. import ActionBar from '../../account/components/action_bar';
  5. const Header = React.createClass({
  6. contextTypes: {
  7. router: React.PropTypes.object
  8. },
  9. propTypes: {
  10. account: ImmutablePropTypes.map.isRequired,
  11. me: React.PropTypes.number.isRequired,
  12. onFollow: React.PropTypes.func.isRequired,
  13. onBlock: React.PropTypes.func.isRequired,
  14. onMention: React.PropTypes.func.isRequired,
  15. onReport: React.PropTypes.func.isRequired
  16. },
  17. mixins: [PureRenderMixin],
  18. handleFollow () {
  19. this.props.onFollow(this.props.account);
  20. },
  21. handleBlock () {
  22. this.props.onBlock(this.props.account);
  23. },
  24. handleMention () {
  25. this.props.onMention(this.props.account, this.context.router);
  26. },
  27. handleReport () {
  28. this.props.onReport(this.props.account);
  29. this.context.router.push('/report');
  30. },
  31. render () {
  32. const { account, me } = this.props;
  33. if (!account) {
  34. return null;
  35. }
  36. return (
  37. <div>
  38. <InnerHeader
  39. account={account}
  40. me={me}
  41. onFollow={this.handleFollow}
  42. />
  43. <ActionBar
  44. account={account}
  45. me={me}
  46. onBlock={this.handleBlock}
  47. onMention={this.handleMention}
  48. onReport={this.handleReport}
  49. />
  50. </div>
  51. );
  52. }
  53. });
  54. export default Header;