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.

64 lines
2.8 KiB

  1. import PureRenderMixin from 'react-addons-pure-render-mixin';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import DropdownMenu from '../../../components/dropdown_menu';
  4. const ActionBar = React.createClass({
  5. propTypes: {
  6. account: ImmutablePropTypes.map.isRequired,
  7. me: React.PropTypes.number.isRequired,
  8. onFollow: React.PropTypes.func.isRequired,
  9. onBlock: React.PropTypes.func.isRequired,
  10. onMention: React.PropTypes.func.isRequired
  11. },
  12. mixins: [PureRenderMixin],
  13. render () {
  14. const { account, me } = this.props;
  15. let menu = [];
  16. menu.push({ text: 'Mention', action: this.props.onMention });
  17. if (account.get('id') === me) {
  18. menu.push({ text: 'Edit profile', href: '/settings/profile' });
  19. } else if (account.getIn(['relationship', 'blocking'])) {
  20. menu.push({ text: 'Unblock', action: this.props.onBlock });
  21. } else if (account.getIn(['relationship', 'following'])) {
  22. menu.push({ text: 'Unfollow', action: this.props.onFollow });
  23. menu.push({ text: 'Block', action: this.props.onBlock });
  24. } else {
  25. menu.push({ text: 'Follow', action: this.props.onFollow });
  26. menu.push({ text: 'Block', action: this.props.onBlock });
  27. }
  28. return (
  29. <div style={{ borderTop: '1px solid #363c4b', borderBottom: '1px solid #363c4b', lineHeight: '36px', overflow: 'hidden', flex: '0 0 auto', display: 'flex' }}>
  30. <div style={{ padding: '10px', flex: '1 1 auto' }}>
  31. <DropdownMenu items={menu} icon='bars' size={24} />
  32. </div>
  33. <div style={{ flex: '1 1 auto', display: 'flex', lineHeight: '18px' }}>
  34. <div style={{ overflow: 'hidden', width: '80px', borderLeft: '1px solid #363c4b', padding: '10px', paddingRight: '5px' }}>
  35. <span style={{ display: 'block', textTransform: 'uppercase', fontSize: '11px', color: '#616b86' }}>Posts</span>
  36. <span style={{ display: 'block', fontSize: '15px', fontWeight: '500', color: '#fff' }}>{account.get('statuses_count')}</span>
  37. </div>
  38. <div style={{ overflow: 'hidden', width: '80px', borderLeft: '1px solid #363c4b', padding: '10px 5px' }}>
  39. <span style={{ display: 'block', textTransform: 'uppercase', fontSize: '11px', color: '#616b86' }}>Follows</span>
  40. <span style={{ display: 'block', fontSize: '15px', fontWeight: '500', color: '#fff' }}>{account.get('following_count')}</span>
  41. </div>
  42. <div style={{ overflow: 'hidden', width: '80px', padding: '10px 5px', borderLeft: '1px solid #363c4b' }}>
  43. <span style={{ display: 'block', textTransform: 'uppercase', fontSize: '11px', color: '#616b86' }}>Followers</span>
  44. <span style={{ display: 'block', fontSize: '15px', fontWeight: '500', color: '#fff' }}>{account.get('followers_count')}</span>
  45. </div>
  46. </div>
  47. </div>
  48. );
  49. },
  50. });
  51. export default ActionBar;